我正在使用Python3,并已安装了tensorflow-gpu:
pip3 install tensorflow-gpu==1.13.1
并且通过以下方式检查已经安装:
pip3 show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.13.1
Summary: TensorFlow is an open source machine learning framework for
everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/lib64/python3.6/site-packages
Requires: tensorflow-estimator, keras-applications, termcolor, absl-py, six,
astor, protobuf, wheel, keras-preprocessing, gast, grpcio, numpy,
tensorboard
Required-by:
但是当我执行以下操作时,它报错了:
user:/home/mydirectory # python3
Python 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/tensorflow/__init__.py", line 24,
in <module>
from tensorflow.python import pywrap_tensorflow # pylint:
disable=unused-import
File "/usr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 25, in <module>
from tensorflow.python.platform import self_check
ModuleNotFoundError: No module named 'tensorflow.python.platform'
我从错误信息中看到它在寻找tensorflow目录。
/usr/lib/python3.6/site-packages/tensorflow
但是pip指示它安装在
/usr/lib64/python3.6/site-packages
如何解决这个问题?
user:/home/mydirectory #
中的#
表示 root 用户吗?如果是这样,与您的用户相比,root 可能有不同的配置。 - McAngus/{usr,}/lib -> /{usr,}/lib64
,并且迁移过程不顺利?/lib
应该只用于32位程序。你能否在问题中添加python3.6 -m site
的输出结果? - hoefling$ pip3 --version pip 8.1.1来自/usr/lib/python3/dist-packages (python 3.5) shekh@shekh:$ python3 Python 3.5.2(默认,Nov 12 2018,13:43:14) [GCC 5.4.0 20160609]在linux上 键入“help”、“copyright”、“credits”或“license”以获取更多信息。 - Shekh Firoz Alam