OSX上的Tensorflow:未能加载本机Tensorflow运行时(没有名为pywrap_Tensorflow_internal的模块)

2024-06-06 20:36:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在我的MacBook(OSX 10.12.5)上安装Tensorflow(r1.2)。 安装工作正常,但当我尝试在python中导入TF时,我会遇到错误。

Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

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


Failed to load the native TensorFlow runtime.

我在一个带有最新tp包的virtualenv(使用virtualenvwrapper)中工作

  • Python2.7.10
  • pip 9.0.1点
  • 纽比1.13.1
  • 车轮0.29.0
  • 六1.10.0

首先,我尝试使用pip install tensorflow安装默认的pip包(不支持GPU)。 之后,我还尝试在不支持CUDA的情况下,从installation tutorial后面的源代码安装tensorflow(配置脚本称为No CUDA support will be enabled for TensorFlow)。构建和安装没有报告任何错误,但是当我尝试导入tensorflow时得到了相同的错误。

相关的问题/答案指出了CUDA的问题或丢失的Windows dll文件,这些似乎不适合我的问题。

欢迎任何帮助。提前谢谢。


Tags: pipinfrompyimportfortensorflow错误
2条回答

我也有同样的问题。我做到了

第一

pip uninstall tensorflow

下载这个tensorflow wheel文件

现在使用(在同一目录中)安装这个

pip install tensorflow-1.6.0-cp36-cp36m-win_amd64.whl

我的回答和你的一样。

我用“rm-r~/tensorflow”删除了tensorflow

当我重新安装后它终于可以工作了

细节在这里:https://www.tensorflow.org/install/install_mac#CommonInstallationProblems

相关问题 更多 >