pytest想告诉我们不正确的python 3版本

pytest想告诉我们不正确的python 3版本,python,macos,python-3.x,pytest,python-venv,Python,Macos,Python 3.x,Pytest,Python Venv,出于某种原因,pytest正在寻找python3.4 $pytest -bash: /usr/local/bin/pytest: /usr/local/opt/python3/bin/python3.4: bad interpreter: No such file or directory 我使用的是OS X,我以前安装过python3.4,但现在已经使用python3.5一段时间了。 编辑:我可能升级不正确,这很可能导致此问题 我使用brew安装了3.4和3.5 $brew list pyt

出于某种原因,pytest正在寻找python3.4

$pytest
-bash: /usr/local/bin/pytest: /usr/local/opt/python3/bin/python3.4: bad interpreter: No such file or directory
我使用的是OS X,我以前安装过python3.4,但现在已经使用python3.5一段时间了。 编辑:我可能升级不正确,这很可能导致此问题

我使用
brew
安装了3.4和3.5

$brew list python3
/usr/local/Cellar/python3/3.5.1/bin/2to3-3.5
...etc.
/usr/local/Cellar/python3/3.5.1/bin/python3.5
...etc.
我将虚拟环境与python3.5和pip3一起使用。我有以下一套:

$echo $VIRTUALENVWRAPPER_PYTHON
/usr/local/bin/python3.5
$ echo $VIRTUALENVWRAPPER_VIRTUALENV
/usr/local/bin/virtualenv-3.5
Python3和pip工作正常:

$ which python
<blah>/.virtualenvs/<blah>/bin/python
$ python
Python 3.5.1 (default, Dec 26 2015, 18:08:53)
$ pip -V
pip 8.1.1 from /<blah>/.virtualenvs/<blah>/lib/python3.5/site-packages (python 3.5)
事情是这样的:

$ pip install --isolated pytest
Collecting pytest
  Using cached pytest-2.9.1-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.29 in /<blah>/.virtualenvs/<blah>/lib/python3.5/site-packages (from pytest)
Installing collected packages: pytest
Successfully installed pytest-2.9.1
$pip安装--独立的pytest
收集pytest
使用缓存的pytest-2.9.1-py2.py3-none-any.whl
已满足要求(使用--升级到升级):py>=1.4.29 in//.virtualenvs//lib/python3.5/site-packages(来自pytest)
安装收集的软件包:pytest
已成功安装pytest-2.9.1
但是pytest仍然在寻找python3.4

python3.4中一定有什么东西悬在那里,Pythest安装很不幸地受到了影响

有人能解释一下吗? 谢谢

啊哼

要运行pytest,请使用:

$py.test
而不是

$pytest
pytest
可执行文件
/usr/local/bin/pytest
已经有一年多的历史了,我假设是旧安装

ls -plah /usr/local/bin/pytest
-rwxr-xr-x  1 root  admin   154B 15 Apr  2015 /usr/local/bin/pytest
我删除了它,并用pip卸载和重新安装了pytest。重新安装不会重新创建
/usr/local/bin/pytest
。事后看来,如果pip确实将任何内容放在active
.virtualenv
目录之外,我会感到惊讶

总之:


pytest
是由较旧版本的
pylint
安装的可执行文件(通过
logilab common
).meh。我们都时不时地做掌纹。
ls -plah /usr/local/bin/pytest
-rwxr-xr-x  1 root  admin   154B 15 Apr  2015 /usr/local/bin/pytest