Why #egg=foo when pip-installing from git repo

前端 未结 4 618
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 10:09

When I do a \"pip install -e ...\" to install from a git repo, I have to specify #egg=somename or pip complains. For example:

pip install -e git://github.com/hii         


        
4条回答
  •  深忆病人
    2021-01-30 10:39

    An Egg is just some bundled python code. In a git url, the egg is the project name. VCS Support

    Normally we install python packages from Pypi, so you specify ONLY the package name and version (or it assumes latest version if you don't specify). Pypi then searches for which egg you want and pip installs that. pip install celery would install the latest published egg and pip install celery[redis] would install a different egg that contains the same celery package and also installs the the latest eggs from whatever packages were listed as dependencies for redis in celery's setup.py.

    With git and gitlab paths, you specify /{user|group}/{repository}.git@{tag}#egg={package-name}. there is a difference between #egg=celery and #egg=celery[redis], but they will both come from the same source code.

    "tag" can also be a branch or commit hash in addition to an actual tag. It is assumed to be master if you do not specify.

    for example, git+https://github.com/celery/celery.git#egg=celery==4.3.0 would check out the master branch and install that. Even though you specified a version number, it is not taken into account in the installation. THE VERSION NUMBER IS IGNORED

    When installing via git or other VCS urls, you will want to find the tag or hash of the version you need. For example, git+https://github.com/celery/celery.git@v4.3.0#egg=celery which will checkout the commit tagged "v4.3.0" and then install the package from that source code. Assuming the maintainers did not egregiously mis-tag their repositories, you can get the version you want like that.

提交回复
热议问题