限制程序中忽略Tensorflow Mac GPU pywrap_tensorflow

时间:2016-07-22 19:56:07

标签: python macos tensorflow nvidia dyld

在跟踪tensorflow的Mac GPU安装说明并从源代码构建软件包后运行python -c "import tensorflow"时,我正在

dyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U_S_Sthird_Uparty_Sgpus_Scuda_Ccudart___Uthird_Uparty_Sgpus_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 third_party/gpus/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 third_party/gpus/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 "<string>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/Library/Python/2.7/site-packages/tensorflow/python/__init__.py", line 48, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 21, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _pywrap_tensorflow

我已经尝试过重建软件包几次并确保在tensorflow源目录之外运行python命令但是卡住了。

提前感谢有关如何解决此问题的任何想法。

2 个答案:

答案 0 :(得分:1)

你试过v 0.9吗? sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0rc0-py2-none-any.whl

答案 1 :(得分:1)

我认为这是因为Mac上的python被视为特权程序。动态库加载器不会接受&#39; runpath&#39;中的相对路径。 (rpath)特权程序。与安全功能有关。

当TF链接时,CUDA会添加相对路径,以便动态加载程序可以找到CUDA共享库。因为它忽略了'rpath ../..."相对路径,它找不到CUDA库,因此无法加载。

我有完全相同的问题。除了关闭操作系统的系统安全性之外,不要认为有解决方案。