TensorFlow安装错误-ImportError: dlopen(/Library/-………_pywrap_tensorflow_internal.so,10): Library not load

来源:互联网 发布:淘宝守望先锋代练 编辑:程序博客网 时间:2024/05/19 05:33

(1)问题简述:

ImportError: dlopen(/Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: @rpath/libcublas.8.0.dylib

  Referenced from: /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
  Reason: image not found

(2)在mac电脑上测试安装好的TensorFlow,结果报了如下错误: 

sudo pip install tensorflowsudo pip install tensorflow-gpu


(3)安装完后,我想测试是否安装成功,打开python,输入import tensorflow as tf 后,出现如下问题: 

bogon:Applications a6$ pythonPython 2.7.10 (default, Jul 15 2017, 17:16:57)[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import tensorflow as tfdyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U@local_Uconfig_Ucuda_S_Scuda_Ccublas___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Slib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathdyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U@local_Uconfig_Ucuda_S_Scuda_Ccuda_Udriver___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Slib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathdyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U@local_Uconfig_Ucuda_S_Scuda_Ccudnn___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Slib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathdyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U@local_Uconfig_Ucuda_S_Scuda_Ccufft___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Slib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathdyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U@local_Uconfig_Ucuda_S_Scuda_Ccurand___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Slib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathdyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U@local_Uconfig_Ucuda_S_Scuda_Ccudart___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Slib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathdyld: warning, LC_RPATH ../local_config_cuda/cuda/lib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathdyld: warning, LC_RPATH ../local_config_cuda/cuda/extras/CUPTI/lib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so being ignored in restricted program because it is a relative pathTraceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/Library/Python/2.7/site-packages/tensorflow/__init__.py", line 24, in <module>    from tensorflow.python import *  File "/Library/Python/2.7/site-packages/tensorflow/python/__init__.py", line 51, in <module>    from tensorflow.python import pywrap_tensorflow  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>    raise ImportError(msg)ImportError: Traceback (most recent call last):  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>    from tensorflow.python.pywrap_tensorflow_internal import *  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>    _pywrap_tensorflow_internal = swig_import_helper()  File "/Library/Python/2.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(/Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: @rpath/libcublas.8.0.dylib  Referenced from: /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so  Reason: image not foundFailed to load the native TensorFlow runtime.See https://www.tensorflow.org/install/install_sources#common_installation_problemsfor some common reasons and solutions.  Include the entire stack traceabove this error message when asking for help.>>>

(4)安装bazel
bazel是谷歌的一款环境依赖包。使用homebrew的安装过程如下:
brew install bazel
(5)最终解决方案:
安装后再次导入import tensorflow,仍然出现同样的错误。后来发现不能同时装tensorflow和tensor flow-gpu(我两个都装了)。pip卸载tenorflow-gpu后,以上错误就解决了。备注:我也试过卸载tensorflow而保留tensorflow-gpu,但是以上错误继续出现。我觉得可能是要支持gpu的计算,我的电脑还要安装一些东西。 
bogon:Applications a6$ sudo pip uninstall tensorflow-gpubogon:Applications a6$ sudo pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
    参考网址:
http://www.tensorfly.cn/tfdoc/get_started/os_setup.html
http://www.jianshu.com/p/bccfaa800f9d


阅读全文
0 0
原创粉丝点击