"egg=" 在 "pip install -e" 中如何使用?
How is "egg=" used in "pip install -e"?
正在尝试测试可编辑安装,但我不确定如何解释结果。
我故意在 egg=
部分打错了,但它仍然能够在没有我帮助的情况下找到鸡蛋:
root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git
Could not detect requirement name for 'git+https://gitlab.com/jame/clientapp.git', please specify one with #egg=your_package_name
root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git#egg=
Could not detect requirement name for 'git+https://gitlab.com/jame/clientapp.git#egg=', please specify one with #egg=your_package_name
root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git#egg=e
Obtaining e from git+https://gitlab.com/jame/clientapp.git#egg=e
Cloning https://gitlab.com/jame/clientapp.git to /src/e
Running setup.py (path:/src/e/setup.py) egg_info for package e produced metadata for project name clientapp. Fix your #egg=e fragments.
Installing collected packages: clientapp
Found existing installation: ClientApp 0.7
Can't uninstall 'ClientApp'. No files were found to uninstall.
Running setup.py develop for clientapp
Successfully installed clientapp
root@6be8ee41b6c9:/# pip3 freeze
asn1crypto==0.24.0
-e git+https://gitlab.com/jame/clientapp.git@5158712c426ce74613215e61cab8c21c7064105c#egg=ClientApp
cryptography==2.6.1
entrypoints==0.3
keyring==17.1.1
keyrings.alt==3.1.1
pycrypto==2.6.1
PyGObject==3.30.4
pyxdg==0.25
SecretStorage==2.3.1
six==1.12.0
所以如果我能把鸡蛋的名字搞得这么糟糕,为什么将它留空或设置为空的东西会被认为是错误的
很难回答,也许可以在 pip's bug tracker 上提出这个问题,并从开发人员那里得到准确的答案。
我的猜测,如果项目是另一个项目的依赖项,egg 名称很重要。例如,如果有人想从 PyPI 安装 A
,从 git 安装 Z
,但是 Z 是 A.
的依赖项
pip install 'A' 'git+https://example.local/Z.git#egg=Z'
egg=
是卸载从 VCS 存储库安装的未打包库时使用的名称,也是依赖解析器在搜索依赖包时使用的名称。
如果您不关心这两个用例,基本上可以将它们设置为任何值。
it found the egg via setup.py
它没有通过 setup.py 找到 egg,pip 找到了 setup.py 并将 setup.py 安装的 egg 名称设置为您指定的任何名称。当您从 VCS 安装时,没有包,因此没有配置 egg 名称,egg=
将安装配置为好像已经安装了具有该 egg 名称的包。
正在尝试测试可编辑安装,但我不确定如何解释结果。
我故意在 egg=
部分打错了,但它仍然能够在没有我帮助的情况下找到鸡蛋:
root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git
Could not detect requirement name for 'git+https://gitlab.com/jame/clientapp.git', please specify one with #egg=your_package_name
root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git#egg=
Could not detect requirement name for 'git+https://gitlab.com/jame/clientapp.git#egg=', please specify one with #egg=your_package_name
root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git#egg=e
Obtaining e from git+https://gitlab.com/jame/clientapp.git#egg=e
Cloning https://gitlab.com/jame/clientapp.git to /src/e
Running setup.py (path:/src/e/setup.py) egg_info for package e produced metadata for project name clientapp. Fix your #egg=e fragments.
Installing collected packages: clientapp
Found existing installation: ClientApp 0.7
Can't uninstall 'ClientApp'. No files were found to uninstall.
Running setup.py develop for clientapp
Successfully installed clientapp
root@6be8ee41b6c9:/# pip3 freeze
asn1crypto==0.24.0
-e git+https://gitlab.com/jame/clientapp.git@5158712c426ce74613215e61cab8c21c7064105c#egg=ClientApp
cryptography==2.6.1
entrypoints==0.3
keyring==17.1.1
keyrings.alt==3.1.1
pycrypto==2.6.1
PyGObject==3.30.4
pyxdg==0.25
SecretStorage==2.3.1
six==1.12.0
所以如果我能把鸡蛋的名字搞得这么糟糕,为什么将它留空或设置为空的东西会被认为是错误的
很难回答,也许可以在 pip's bug tracker 上提出这个问题,并从开发人员那里得到准确的答案。
我的猜测,如果项目是另一个项目的依赖项,egg 名称很重要。例如,如果有人想从 PyPI 安装 A
,从 git 安装 Z
,但是 Z 是 A.
pip install 'A' 'git+https://example.local/Z.git#egg=Z'
egg=
是卸载从 VCS 存储库安装的未打包库时使用的名称,也是依赖解析器在搜索依赖包时使用的名称。
如果您不关心这两个用例,基本上可以将它们设置为任何值。
it found the egg via setup.py
它没有通过 setup.py 找到 egg,pip 找到了 setup.py 并将 setup.py 安装的 egg 名称设置为您指定的任何名称。当您从 VCS 安装时,没有包,因此没有配置 egg 名称,egg=
将安装配置为好像已经安装了具有该 egg 名称的包。