2016-12-04 85 views
3

我花了3個多小時安裝啓用GPU的TensorFlow,但它仍然無法正常工作。在Mac OS上安裝TensorFlow的問題(10.12.1)

我用「點子」安裝指南去了。

這裏是我做過的任務,依次是:

1.1下載並安裝CUDA工具包文件(.dmg V8.0)

1.2下載並解壓縮CUDA深層神經網絡( cuDNN V5)

1.3拷貝文件

cd ~/Downloads/cuda 
sudo mv include/cudnn.h /Developer/NVIDIA/CUDA-8.0/include/ 
sudo mv lib/libcudnn* /Developer/NVIDIA/CUDA-8.0/lib 
sudo ln -s /Developer/NVIDIA/CUDA-8.0/lib/libcudnn* /usr/local/cuda/lib/ 

2.1組變量

export CUDA_HOME=/usr/local/cuda 
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64" 
export DYLD_LIBRARY_PATH="$CUDA_HOME/lib" 
export PATH="$CUDA_HOME/bin:$PATH" 

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.0rc0-py2-none-any.whl 

3.1安裝PIP

sudo easy_install pip 

3.2安裝tensorflow

sudo pip install tensorflow --ignore-installed numpy 

3.3安裝二進制

sudo pip install --upgrade $TF_BINARY_URL 

最後,當我要檢查,如果TensorFlow工作,我進入Python和導入它:

>>> import tensorflow as tf 

下面是完整的錯誤消息,我得到:

dyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/[email protected]_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 

有任何想法嗎?

+0

請看看我的答案在這裏。 http://stackoverflow.com/a/41073045/1831325 –

回答

0

似乎是一個簡單

sudo pip uninstall tensorflow 
sudo pip install tensorflow --ignore-installed numpy 

的伎倆......