美文网首页
tensorflow mac 安装问题

tensorflow mac 安装问题

作者: hustyanye | 来源:发表于2018-08-29 20:31 被阅读0次

    在mac下直接pip install tensorflow后,直接import回有报错如下:

    Traceback (most recent call last):

      File "", line 1, in

      File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 22, in

        from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

      File "/usr/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in

        from tensorflow.python import pywrap_tensorflow

      File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in

        raise ImportError(msg)

    ImportError: Traceback (most recent call last):

      File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in

        from tensorflow.python.pywrap_tensorflow_internal import *

      File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in

        _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, 6): Symbol not found: _SecKeyCopyExternalRepresentation

      Referenced from: /usr/local/lib/python2.7/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 /usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so

    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

    查了很多,最终我的解决方法参考https://stackoverflow.com/questions/38710339/library-not-loaded-rpath-libcudart-7-5-dylib-tensorflow-error-on-mac

    # Mac OS X, CPU only, Python 2.7:$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py2-none-any.whl

    $ sudo pip install --upgrade $TF_BINARY_URL# Mac OS X, CPU only, Python 3.4 or 3.5:$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

    $ sudo pip3 install --upgrade $TF_BINARY_URL

    相关文章

      网友评论

          本文标题:tensorflow mac 安装问题

          本文链接:https://www.haomeiwen.com/subject/tnzkwftx.html