【问题标题】:tensorflow ImportError "@rpath/libcudart.8.0.dylib" Image Not Foundtensorflow ImportError "@rpath/libcudart.8.0.dylib" 找不到图像
【发布时间】:2017-06-18 16:29:51
【问题描述】:

在 Mac Sierra 中尝试使用 cuda_gpu 的 Tensorflow,系统默认的 python 2.7,没有虚拟环境。

在进行基本测试“import tensorflow”时遇到 ImportError

dyld: 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.so being ignored in restricted program because it is a relative path
dyld: warning, LC_RPATH ../local_config_cuda/cuda/lib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so being ignored in restricted program because it is a relative path
dyld: warning, LC_RPATH ../local_config_cuda/cuda/extras/CUPTI/lib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so being ignored in restricted program because it is a relative path
Traceback (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 60, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: dlopen(/Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: @rpath/libcudart.8.0.dylib
  Referenced from: /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so
  Reason: image not found

我已经尝试了@norman_h 从'Library not loaded: @rpath/libcudart.7.5.dylib' TensorFlow Error on Mac 建议的“local_config_cuda”步骤,但仍然无法正常工作。

CUDA 示例可以工作,所以它看起来是一个 lib 参考问题...可以摆脱我吗 一些光?谢谢!

【问题讨论】:

  • 需要禁用 SIP(​​安全完整性保护)并设置 dyld/ld 库路径以及路径变量以包含 cuda 库的位置
  • 禁用 SIP 后,整个过程立即生效,非常感谢

标签: python macos installation tensorflow


【解决方案1】:

根据@Yaroslav 的上述评论,禁用 SIP 会立即解决问题。

【讨论】:

    猜你喜欢
    • 2016-12-07
    • 2018-10-20
    • 2018-03-11
    • 1970-01-01
    • 2018-11-19
    • 2018-08-30
    • 2014-11-24
    • 2021-06-15
    • 1970-01-01
    相关资源
    最近更新 更多