gpt4 book ai didi

python - 在 Mac OS (10.12.1) 上安装 TensorFlow 的问题

转载 作者:行者123 更新时间:2023-11-28 19:10:30 27 4
gpt4 key购买 nike

我已经花了 3 个多小时来安装支持 GPU 的 TensorFlow,但它仍然无法正常工作。

我使用了“pip”安装指南。

以下是我按顺序完成的任务:

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/_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

有什么想法吗?

最佳答案

看起来很简单

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

成功了...

关于python - 在 Mac OS (10.12.1) 上安装 TensorFlow 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40961902/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com