我正在使用virtualenvwrapper。在我使用Python3的virtualenv
下,我成功安装了futures
,然后如果我安装了其他任何东西,它将弹出来自futures
软件包的语法错误
错误如下:
$ pip install futures
Collecting futures
Installing collected packages: futures
Successfully installed futures-3.1.1
$ pip install sklearn
Traceback (most recent call last):
File "/data/analytics/yliu/.virtualenvs/alice1/bin/pip", line 7, in <module>
from pip._internal import main
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
from pip._internal.commands import (
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 24, in <module>
from pip._internal.index import PackageFinder
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/index.py", line 41, in <module>
from pip._internal.wheel import Wheel
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/wheel.py", line 7, in <module>
import compileall
File "/usr/local/anaconda3/anaconda/lib/python3.6/compileall.py", line 20, in <module>
from concurrent.futures import ProcessPoolExecutor
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
我检查了以下问题的答案:pip install error within Python 3 virtualenv,但这对我不起作用。 futures
软件包确实安装在正确版本的python 3.6.5中。
我尝试在python3.6上全局安装Future,并且一切正常。因此futures
和virtualenv
似乎有些问题。
有人可以帮我解决这个问题吗?
非常感谢
答案 0 :(得分:1)
futures package at PyPI是concurrent.futures标准库模块向Python 2的反向移植。
要在Python 3中使用futures
,您无需安装任何程序,它是一个标准的库模块。
现在您的virtualenv包含一个损坏的Python 2模块。我建议删除virtualenv并重新创建它。