我正在尝试使用安装张量流pip3 install tensorflow-gpu
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 9, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip3')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/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-9.0.1-py3.5.egg/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/index.py", line 31, in <module>
from pip.wheel import Wheel, wheel_ext
File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/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/lib/python2.7/dist-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/usr/lib/python2.7/dist-packages/concurrent/futures/_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
使用 pip3 时,系统似乎混淆了 python3 和 python2 的库。对于使用 的 pyhton2,安装有效pip install tensorflow-gpu
。
编辑1
我试过了python3 -m pip install tensorflow-gpu
,但是最后一个库仍然是python2。
/usr/lib/python2.7/dist-packages/concurrent/futures/_base.py
编辑2
我再次尝试了这个,我发现因为我安装了 ROS,它将 PYTHONPATH 设置为 python 2。所以我不得不修改 ROS 的设置 bash,这样 PYTHONPATH 就由我而不是 ROS 设置。