【发布时间】:2017-10-16 21:53:24
【问题描述】:
我通过 pip 在我的 mac 上安装了 tensorflow,并且我使用 anaconda 作为我的 IDE。 当我运行命令时
import tensoflow
我收到以下错误:
Traceback (most recent call last):
File "<ipython-input-3-a649b509054f>", line 1, in <module>
import tensorflow
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/Applications/anaconda3/lib/python3.5/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/Applications/anaconda3/lib/python3.5/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: @rpath/libcublas.8.0.dylib
Referenced from: /Applications/anaconda3/lib/python3.5/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.
我还在终端中运行了pip list 以检查它是否安装正确。
它列出了我已安装的所有 tensorflow 库。
我正在使用 Anaconda v1.6.8 和 Spyder v3.2.3
【问题讨论】:
-
您的 Mac 中有 NVIDIA GPU 吗?
-
Mac没有Nvidia GPU,所以我认为使用GPU版本对我没有任何好处。所以我应该卸载tensorflow-gpu吗?
-
是的,卸载
tensorflow-gpu应该可以解决问题。 -
@mrry 卸载
tensorflow-gpu工作但现在在导入 keras 时出现此错误:File "/Applications/anaconda3/lib/python3.5/imp.py", line 271, in find_module "not {}".format(type(path))) RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
标签: python tensorflow installation deep-learning anaconda