我正在尝试在我的旧 Mac 上安装 tensorflow 1.10,但我每次都遇到同样的问题。我一启动 python shell 就收到以下错误。
我确实首先尝试将它安装在 virtualenv 中,之后,我尝试仅使用 pip 安装它并得到了同样的错误。此外,当我尝试使用 conda 安装它时,同样的问题再次出现。我用谷歌搜索并在此处查看,但仍无法解决,可能是由于我的笨拙表演。我已经卸载了 anaconda 和 pip 并再次尝试,但我总是遇到同样的错误。
我确实安装了 CUDA,尽管我尝试在有和没有 GPU 的情况下安装 tensorflow。
错误导致:无法加载 native TensorFlow 运行时。
我希望有人能够提供帮助,因为我真的很想学习这个。
(tensorflow) abc:~ me$ python
import tensorflow as tf
Traceback (most recent call last):
File "/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/me/tensorflow/lib/python3.6/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 "/Users/me/tensorflow/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/Users/me/tensorflow/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _SecKeyCopyExternalRepresentation
Referenced from: /Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so (which was built for Mac OS X 10.12)
Expected in: /System/Library/Frameworks/Security.framework/Versions/A/Security
in /Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
在处理上述异常的过程中,又发生了一个异常:
>Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/me/tensorflow/lib/python3.6/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 "/Users/me/tensorflow/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/Users/me/tensorflow/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _SecKeyCopyExternalRepresentation
Referenced from: /Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so (which was built for Mac OS X 10.12)
Expected in: /System/Library/Frameworks/Security.framework/Versions/A/Security
in /Users/me/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
无法加载 native TensorFlow 运行时。
参见 https://www.tensorflow.org/install/install_sources#common_installation_problems
对于一些常见的原因和解决方案。包括整个堆栈跟踪 寻求帮助时在此错误消息上方。
最佳答案
我认为 TensorFlow 1.10 和 OS X El Capitan (10.11.6) 有问题!
只需使用 pip 命令安装 1.9.0 而不是 1.10:
pip3 install tensorflow==1.9.0
或其 GPU 版本:
pip3 install tensorflow-gpu==1.9.0
关于python - 在 El Capitan 10.11.6 上安装 Tensorflow 1.10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51848122/