“pip install -e”中如何使用“egg=”?

Bra*_*ley 6 python pip setuptools

尝试测试可编辑安装,但我不确定如何解释结果。

我故意在这部分打错字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
Run Code Online (Sandbox Code Playgroud)

因此,如果我可以把鸡蛋名称搞得这么糟糕,为什么将其留空或设置为空会被视为错误

sin*_*roc 4

这是过时的表示法。如今,只要有可能,就应该使用以下符号:

python -m pip install 'ProjecName @ git+https://example.local/repository.git@1.3.1'
Run Code Online (Sandbox Code Playgroud)

我猜,如果该项目是另一个项目的依赖项,那么名称很重要。例如,如果有人想要APyPIgitZ安装,但又依赖于.ZA

python -m pip install 'A' 'git+https://example.local/Z.git#egg=Z'
Run Code Online (Sandbox Code Playgroud)

或使用新的符号:

python -m pip install 'A' 'Z @ git+https://example.local/repository.git
Run Code Online (Sandbox Code Playgroud)