我正在安装一些软件包,之后pip不再起作用了。即使我尝试了一些命令如:sudo pip show requets我也会收到此错误。
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/local/lib/python3.5/dist-packages/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/usr/local/lib/python3.5/dist-packages/pip/index.py", line 31, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 6, in <module>
import compileall
File "/usr/lib/python3.5/compileall.py", line 20, in <module>
from concurrent.futures import ProcessPoolExecutor
File "/usr/local/lib/python3.5/dist-packages/futures-3.1.1-py3.5.egg/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/usr/local/lib/python3.5/dist-packages/futures-3.1.1-py3.5.egg/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
非常感谢!
答案 0 :(得分:2)
您似乎已在python3.5上安装了futures包。
这是python3.2 +包的仅python2后端。
您需要删除/usr/local/lib/python3.5/dist-packages/futures-3.1.1-py3.5.egg
然后它应该再次运行。
你不需要在python3.5上使用它,它已经包含在标准库中了。
答案 1 :(得分:0)
看起来您的点数已损坏,您可以使用pip --version
检查点数版本,也许将pip升级到最新版本可能会解决您的问题,只需尝试
sudo pip install --upgrade pip
,现在检查点数版本,如果仍显示旧版本,请尝试使用ln -s /usr/local/bin/pip /usr/bin/
重新创建simlink
答案 2 :(得分:0)
如果没有其他方法适合您,您应该尝试重新安装pip
。执行以下操作:
sudo apt-get install --reinstall python2.7
sudo apt-get purge python-pip
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
那应该有用。完成后,运行pip --version
并发布结果。