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

2019-03-09 05:35发布

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/hiidef/oauth2app.git#egg=oauth2app

What's the significance of this "egg" string?

3条回答
闹够了就滚
2楼-- · 2019-03-09 06:15

https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support says:

The "project name" component of the url suffix "egg=-" is used by pip in its dependency logic to identify the project prior to pip downloading and analyzing the metadata. The optional "version" component of the egg name is not functionally important. It merely provides a human-readable clue as to what version is in use. For projects where setup.py is not in the root of project, "subdirectory" component is used. Value of "subdirectory" component should be a path starting from root of the project to where setup.py is located.

From this I deduce that the egg value is only used for dependency checks and therefore I think, by convention, the package name (i.e. some-pypi-package-name) should be used, not any contained folder (i.e. some_pypi_package_name)

查看更多
女痞
3楼-- · 2019-03-09 06:22

per pip install -h the "egg" string is the directory that gets checked out as part of the install

查看更多
虎瘦雄心在
4楼-- · 2019-03-09 06:29

You have to include #egg=Package so pip knows what to expect at that URL. See https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

more on eggs

查看更多
登录 后发表回答