从源安装后,TensorFlow无法加载运行时

时间:2017-08-15 23:26:03

标签: python tensorflow bazel

我开始在Ubuntu Linux 16.06 LTS,running the commands from the TensorFlow Linux compilation instructions上从源代码编译TensorFlow。

我的CUDA和CuDNN设置正常工作,因为预编译的TensorFlow nvidia-docker镜像可以正常工作。

使用bazel构建TensorFlow Python滚轮,然后使用pip安装滚轮后,我在尝试导入TensorFlow时收到以下错误消息:

>>> import tensorflow
Traceback (most recent call last):
  File "/home/james/workspace/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/james/workspace/tensorflow/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/james/workspace/tensorflow/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/james/workspace/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/james/workspace/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

1 个答案:

答案 0 :(得分:2)

在安装了Python轮后,从TensorFlow源目录运行Python时会发生此错误。

在安装Python滚轮之前尝试导入TensorFlow时的similar error happens

此问题的解决方案是将您的工作目录更改为其他内容,同时仍保留在安装Python滚轮的virtualenv中。