pip for python3.5破Ubuntu 16.10

时间:2017-02-13 11:47:25

标签: ubuntu pip python-3.5

我遇到了一个奇怪的问题(3)。

当我执行像pip --version(或pip3 --version)这样的pip命令时,我收到了这个错误:

Traceback (most recent call last):
  File "/usr/local/bin/pip3", 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/concurrent/futures/__init__.py", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File "/usr/local/lib/python3.5/dist-packages/concurrent/futures/_base.py", line 357
    raise type(self._exception), self._exception, self._traceback
                               ^
SyntaxError: invalid syntax

Python版

Python 3.5.2+ (default, Sep 22 2016, 12:18:14) 
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

~/ pip

pip          pip2         pip2.7       pip3         pip-compile  pip-sync   

我安装了pip2.7并且运行良好。我在Ubuntu 16.10下,我不明白这是什么问题。

由于

2 个答案:

答案 0 :(得分:12)

我遇到了同样的问题。替换

raise type(self._exception), self._exception, self._traceback

raise Exception(self._exception).with_traceback(self._traceback)

在/usr/local/lib/python3.5/dist-packages/concurrent/futures/_base.py

答案 1 :(得分:7)

期货库支持一些Python 3功能,以便它们可以在Python 2中使用。

除非你绝对必须安装它,否则你可以:

pip uninstall futures

将其从Python 3虚拟环境中删除。