2017-02-28 63 views
0

据我所知,pip安装[extras_require here]一直工作。在添加该功能时,我找不到任何文档,但即使是在非常旧的机器上,我也从未遇到任何问题。pip install [测试]不能在python2.7.9下工作pip版本6.0.7

是pip绝对是这里的问题。我可以添加'pip install --upgrade pip',但是我没有对当前存在问题的repo的合并权限。

从setup.py

extras_require={ 
    'test': ['flake8', 'pytest>=2.9.0'], 
}, 

在蟒蛇2.7.9

$ python --version 
Python 2.7.9 
$ pip --version 
pip 6.0.7 from /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (python 2.7) 
$ pip install .[test] 
Collecting .[test] 
    Could not find any downloads that satisfy the requirement .[test] 
    No distributions at all found for .[test] 


The command "pip install .[test]" failed and exited with 1 during . 

从3.5.2:

$ python --version 
Python 3.5.2 
$ pip --version 
pip 9.0.1 from /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (python 3.5) 
$ pip install .[test] 
Processing /home/travis/build/Brian-Williams/repo_python 
Collecting flake8 (from refactor-me==0.1.0) 
    Downloading flake8-3.3.0-py2.py3-none-any.whl (66kB) 
    100% |████████████████████████████████| 71kB 6.1MB/s 
Requirement already satisfied: pytest>=2.9.0 in /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (from refactor-me==0.1.0) 
Collecting pycodestyle<2.4.0,>=2.0.0 (from flake8->refactor-me==0.1.0) 
    Downloading pycodestyle-2.3.1-py2.py3-none-any.whl (45kB) 
    100% |███████████████���████████████████| 51kB 10.6MB/s 
Collecting mccabe<0.7.0,>=0.6.0 (from flake8->refactor-me==0.1.0) 
    Downloading mccabe-0.6.1-py2.py3-none-any.whl 
Collecting pyflakes<1.6.0,>=1.5.0 (from flake8->refactor-me==0.1.0) 
    Downloading pyflakes-1.5.0-py2.py3-none-any.whl (225kB) 
    100% |████████████████████████████████| 225kB 7.1MB/s 
Requirement already satisfied: py>=1.4.29 in /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (from pytest>=2.9.0->refactor-me==0.1.0) 
Installing collected packages: pycodestyle, mccabe, pyflakes, flake8, refactor-me 
    Running setup.py install for refactor-me ... - done 
Successfully installed flake8-3.3.0 mccabe-0.6.1 pycodestyle-2.3.1 pyflakes-1.5.0 refactor-me-0.1.0 
+0

它看起来像在1.1版本的pip版本中已经被支持。见[这里](http://stackoverflow.com/questions/4796936/does-pip-handle-extras-requires-from-setuptools-distribute-based-sources)。 – Brian

回答

1

为了您的PIP的版本,你需要运行

pip install -e .[test] 

be able to install extras from a directory

+0

这就是我正在做的。从.travis.yml:''pip install'。[test]“'' – Brian

+0

你没有这样做。你错过了'-e'。 –

+0

该-e正装在编辑模式,该模式是不必要的,因为这是一个CI作业其中代码将不被编辑和容器将被删除一次完成的一部分。我也通过升级pip解决了下面的问题,并且仍然没有以编辑模式安装。在没有理由的情况下使用可变代码是一个坏主意。 – Brian

0

我有合并访问权限。添加升级画中画的.travis.yml安装阶段固定它:

install: 
    # update pip to ensure extras_require format is supported 
    - 'pip install --upgrade pip' 
    - 'pip install ".[test]"' 

从成功运行与PIP-9.0.1替代6.0.7是增量。