Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何安装git+;https://from setup.py使用install\u需要_Python_Git_Pip_Setuptools_Setup.py - Fatal编程技术网

Python 如何安装git+;https://from setup.py使用install\u需要

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

我有一个项目,我必须从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 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安装(假设我在该文件中有相同的字符串),而不是使用direct
pip install git+…
,则不会发生错误

如何修复此解析错误

到目前为止,我所尝试的:

  • 用“/”/“/”包装字符串
  • 在字符串之前添加“r”

  • install\u requires
    必须是一个字符串或字符串列表,其中包含名称和可选URL,才能从以下位置获取软件包:

    install_requires=[
        'pycocotools @ git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
    ]
    
    看到和


    这需要
    pip安装
    包括
    pip安装。
    并且不适用于
    python setup.py安装

    这是否回答了您的问题?相关:@BramVanroy
    dependency\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
    ,那么它应该是一致的。