我浪费了很多时间才能让导入tensorflow 在我的Mac上运行。在解决了这么多问题之后,我终于陷入了困境,无法在任何地方找到同样的问题来解决它。如果您认为它重复,请随时标记并向我推荐一些链接,我可以找到解决此问题的方法..
问题:
我按照这里提到的一步一步安装了tensorflow:https://www.tensorflow.org/install/install_mac和原生点。我也照顾SIP和tensorflow也成功安装,但是当我尝试在python中导入tensorflow时,我收到这个错误,我无法解决并放弃..这是我得到的消息..
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: @rpath/libcublas.8.0.dylib
Referenced from: /usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
Reason: image not found
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
如果您需要任何其他相关信息,请随时询问。
答案 0 :(得分:0)
你的Mac上有NVIDA GPU吗? 如果没有,则不要使用张量流的CUDA版本。 卸载张量流并重新安装张量流的CPU版本,您将能够绕过错误。