【发布时间】:2017-01-04 22:21:46
【问题描述】:
我最近升级到 python 3.5 并尝试使用 TensorFlow。我按照https://www.tensorflow.org/versions/r0.10/get_started/os_setup.html 的说明安装了启用 GPU 的 tensorflow:
# Mac OS X, GPU enabled, Python 3.4 or 3.5:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0rc0-py3-none-any.whl
但是,当我尝试使用 tensorflow 时,它抛出了一个非常奇怪的错误:
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/user/path/venv2/lib/python3.5/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/Users/user/path/venv/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 48, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/user/path/venv/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/Users/user/path/venv/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/Users/user/path/venv/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/Users/user/path/venv/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/user/path/venv/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: @rpath/libcudart.7.5.dylib
Referenced from: /Users/user/path/venv/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so
Reason: image not found
为什么会抛出这个错误?我知道我没有 GPU,但我从 TensorFlow 页面上的其他对话中得到的印象是,我不需要使用可能使用 GPU 的版本。
【问题讨论】:
-
Library not loaded: @rpath/libcudart.7.5.dylib你安装CUDA了吗? -
你从哪里得到这个印象?听起来……错了。您可以强制 gpu 版本构建仅在 CPU 上运行的节点,但据我所知,您仍然需要安装 CUDA,为此我假设您需要一个 nvidia GPU。
-
@DomJack github.com/tensorflow/tensorflow/issues/3632 上面写着:
TensorFlow has separate builds for CPU and GPU binaries (http://ci.tensorflow.org/view/Nightly/) You seem to be running a GPU build on a machine that has no GPUs, hence the warning. However, it should still work regardless, this message is purely informational.来自 TF 的开发者。 -
你每天都会学到新东西...
标签: python tensorflow