我正在使用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: [email protected]
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

如何解决此问题?

最佳答案

Please follow below steps..
0) please login with root permission or sudo and write this command in terminal

1)pip3 install tensorflow-gpu==1.13.1

2)pip3 --version
  pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
3)shekh@shekh:~$ python3
  Python 3.5.2 (default, Nov 12 2018, 13:43:14)
  [GCC 5.4.0 20160609] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>>

https://www.tensorflow.org/install/pip

linux - 没有名为 &#39;tensorflow.python.platform&#39;的模块-LMLPHP

linux - 没有名为 &#39;tensorflow.python.platform&#39;的模块-LMLPHP

关于linux - 没有名为 'tensorflow.python.platform'的模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56689815/

10-16 19:08