Python 如何安装git+;https://from setup.py使用install\u需要
我有一个项目,我必须从git+https进行安装: 我可以这样做:Python 如何安装git+;https://from setup.py使用install\u需要,python,git,pip,setuptools,setup.py,Python,Git,Pip,Setuptools,Setup.py,我有一个项目,我必须从git+https进行安装: 我可以这样做: virtualenv -p python3.5 bla . bla/bin/activate pip install numpy # must have numpy before the following pkg... pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI' 但是,我想在install\u requ
virtualenv -p python3.5 bla
. bla/bin/activate
pip install numpy # must have numpy before the following pkg...
pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
但是,我想在install\u requires
中的setup.py文件中使用它:
from setuptools import setup
setup(install_requires='git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI', setup_requires='numpy')
然后,从包含setup.py
由于分析错误,此操作不起作用:
Complete output (1 lines):
error in bla_bla setup command: 'install_requires' must be a string or list of strings containing valid project/version requireme
nt specifiers; Invalid requirement, parse error at "'+https:/'"
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
如果我使用pip install-r requires.txt安装(假设我在该文件中有相同的字符串),而不是使用directpip install git+…
,则不会发生错误
如何修复此解析错误
到目前为止,我所尝试的:
用“/”/“/”包装字符串
在字符串之前添加“r”
install\u requires
必须是一个字符串或字符串列表,其中包含名称和可选URL,才能从以下位置获取软件包:
install_requires=[
'pycocotools @ git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
]
看到和
这需要pip安装
包括pip安装。
并且不适用于python setup.py安装
这是否回答了您的问题?相关:@BramVanroydependency\u链接
被宣布为过时,最后出现在pip
19.0中。请收回你的投票。虽然这是同一个核心问题,重复问题的答案也回答了这个问题()@phd更新了这个问题,使之具体化,以更好地区分问题,并撤回了我的投票。我将为python setup.py安装与pip安装添加此参考。
part::“到目前为止,我们的政策是,如果使用pip-install
解决您的问题,您应该使用pip-install
,我们不会解决这个问题”,这很糟糕,因为pip-install“pkg\u名称”之间存在不一致“/pip install-r
和pip install-e.
。无论如何谢谢你@ClsForCookies什么是不一致性?我相信如果所有的需求都遵循PEP 508,并且没有直接调用setup.py
,那么它应该是一致的。