使用python3.6安装Tensorflow失败

这是我目前的环境

$ pip show tensorflow
Name: tensorflow
Version: 1.4.0
Summary: TensorFlow helps the tensors flow
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/local/lib/python3.6/site-packages
Requires: wheel, tensorflow-tensorboard, enum34, six, numpy, protobuf

$ pip show protobuf
Name: protobuf
Version: 3.5.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: protobuf@googlegroups.com
Author-email: protobuf@googlegroups.com
License: 3-Clause BSD License
Location: /usr/local/lib/python3.6/site-packages
Requires: six, setuptools

$pip show six
Name: six
Version: 1.11.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /usr/local/lib/python3.6/site-packages
Requires:

Traceback(最近一次调用最后一次):文件“”,第1行,在文件“/Users/joson/tensorflow/lib/python3.6/site-packages/tensorflow/init.py”,第24行,来自tensorflow . python import *文件“/Users/joson/tensorflow/lib/python3.6/site-packages/tensorflow/python/init.py”,第51行,来自tensorflow.python import pywrap_tensorflow文件“/ Users / joson / tensorflow / lib / python3.6 / site-packages / tensorflow / python / pywrap_tensorflow.py“,第52行,引发ImportError(msg)ImportError:Traceback(最近一次调用最后一次):文件”/ Users / joson / tensorflow / lib / python3 .6 / site-packages / tensorflow / python / pywrap_tensorflow.py“,第41行,来自tensorflow.python.pywrap_tensorflow_internal import * File”/Users/joson/tensorflow/lib/python3.6/site-packages/tensorflow/python /pywrap_tensorflow_internal.py“,第28行,在_pywrap_tensorflow_internal = swig_import_helper()文件”/Users/joson/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py“,第24行,swig_import_helper mod = imp.l oad_module(' pywrap_tensorflow_internal',fp,pathname,description)文件“/Users/joson/tensorflow/lib/python3.6/imp.py”,第242行,在load_module中返回load_dynamic(名称,文件名,文件)文件“/ Users /joson/tensorflow/lib/python3.6/imp.py“,第342行,在load_dynamic中返回_load(spec)ImportError:dlopen(/Users/joson/tensorflow/lib/python3.6/site-packages/tensorflow/python /_pywrap_tensorflow_internal.so,10):未加载库:@ rpath / libcublas.8.0.dylib引用自:/Users/joson/tensorflow/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so原因:image未找到

回答(1)

2 years ago

正如评论中所讨论的,问题是在没有安装CUDA的Mac上安装了用于Mac OS X的TensorFlow的 GPU 版本 . 卸载并重新安装TensorFlow的CPU版本应该可以解决问题 .

(请注意,不再正式支持适用于Mac OS X的TensorFlow GPU版本 . )