“pip install --editable ./” vs “python setup.py develop”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30306099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"pip install --editable ./" vs "python setup.py develop"
提问by PeterE
Is there any significant difference between
之间是否有显着差异
pip install -e /path/to/mypackage
and the setuptools variant?
和 setuptools 变体?
python /path/to/mypackage/setup.py develop
采纳答案by sobolevn
Try to avoid calling setup.py
directly, it will not properly tell pip that you've installed your package.
尽量避免setup.py
直接调用,它不会正确地告诉 pip 你已经安装了你的包。
With pip install -e
:
与pip install -e
:
For local projects, the “SomeProject.egg-info” directory is created relative to the project path. This is one advantage over just using
setup.py develop
, which creates the “egg-info” directly relative the current working directory.
对于本地项目,“SomeProject.egg-info”目录是相对于项目路径创建的。这是与仅使用相比的一个优势
setup.py develop
,它直接相对于当前工作目录创建“egg-info”。
More: docs
更多:文档
Also read the setuptools' docs.
另请阅读 setuptools 的文档。
回答by user2488286
One more difference: pip install -e
uses wheel while
python setup.py develop
doesn't use it.
还有一个区别:pip install -e
使用轮子
python setup.py develop
而不使用它。
With install
, you could achieve the same behavior by usingpip install -e /path/to/package --no-use-wheel
使用install
,您可以通过使用实现相同的行为pip install -e /path/to/package --no-use-wheel
More info on wheels : python wheels
有关轮子的更多信息:python 轮子
回答by ely
Another difference that may favor pip install -e
is that if your project has dependencies in install_requires
in setup.py
, then pip install -e .
installs dependencies with pip, while python setup.py develop
can install with easy_install
, and may cause problems re: 'egg-info' as mentioned above. When install-requires
uses dependency_links
with custom git URLs, with attached egg identifiers, this can be especially annoying.
另一个可能有利的区别pip install -e
是,如果您的项目在install_requires
in 中有依赖项setup.py
,则pip install -e .
使用 pip 安装依赖项,而python setup.py develop
可以使用 安装easy_install
,并且可能会导致问题 re: 'egg-info' 如上所述。当与自定义 git URL 一起install-requires
使用dependency_links
时,附加了鸡蛋标识符,这可能特别烦人。