简体   繁体   English

Python无法将张量流导入Mac OS X 10.8

[英]Python unable to import tensorflow to Mac OS X 10.8

I am trying to install tensorflow on my mac air (specs: OSX 10.8.4, 4GB RAM). 我正在尝试在我的mac air上安装tensorflow(规格:OSX 10.8.4,4GB RAM)。 While tensorflow installs cleanly, as on the tensorflow.org page, and I am able to do $ source bin/activate to get a tensorflow prompt, I am not able to import the package in python. 虽然tensorflow安装干净,就像在tensorflow.org页面上一样,并且我能够执行$ source bin / activate以获得tensorflow提示,但是我无法在python中导入包。 This is what I get: 这就是我得到的:

    >>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 22, in <module>
    from tensorflow.python.client.client_lib import *
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/client_lib.py", line 35, in <module>
    from tensorflow.python.client.session import InteractiveSession
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 11, in <module>
    from tensorflow.python import pywrap_tensorflow as tf_session
  File "/usr/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/usr/local/lib/python2.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(/usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 2): Symbol not found: ___sincos_stret
  Referenced from: /usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so
  Expected in: /usr/lib/libSystem.B.dylib
 in /usr/local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so

I looked at the common problems section on tensorflow, as well as searched for the ImportError above but have had no luck so far. 我查看了tensorflow上的常见问题部分,以及搜索上面的ImportError但到目前为止没有运气。 I wonder if this is a protobuf issue as referenced in Error in python after 'import tensorflow': TypeError: __init__() got an unexpected keyword argument 'syntax' . 我想知道这是否是在'import tensorflow'之后在python中的Error中引用的protobuf问题:TypeError:__ init __()得到了一个意外的关键字参数'syntax' Thanks in advance. 提前致谢。

The issue appears to be that the binary distribution of TensorFlow is not compatible with Mac OS X 10.8. 问题似乎是TensorFlow的二进制分发与Mac OS X 10.8不兼容。 The relevant part of the error message is this one: 错误消息的相关部分是这一个:

Symbol not found: ___sincos_stret

According to various sources , this is a known issue when using binaries compiled for a newer version of Mac OS X on 10.8 (Mavericks), because the symbol ___sincos_stret is not defined in the standard libraries for that version of the OS. 根据各种 消息来源 ,当在10.8(Mavericks)上使用为较新版本的Mac OS X编译的二进制文件时,这是一个已知问题,因为在该版本的操作系统的标准库中没有定义符号___sincos_stret

To address this, you will need to (i) upgrade to Mac OS X 10.9 or later, (ii) follow the instructions to install from source , or (iii) use Docker . 要解决此问题,您需要(i)升级到Mac OS X 10.9或更高版本,(ii)按照说明从源代码安装 ,或(iii)使用Docker

I had similar issue. 我有类似的问题。 I used docker toolbox and was able to run tensorflow. 我使用了docker toolbox并且能够运行tensorflow。 You can follow my question and my solution. 您可以关注我的问题和我的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM