gpt4 book ai didi

Python 无法将 tensorflow 导入 Mac OS X 10.8

转载 作者:太空狗 更新时间:2023-10-30 02:58:32 25 4
gpt4 key购买 nike

我正在尝试在我的 mac air 上安装 tensorflow(规范:OSX 10.8.4、4GB RAM)。虽然 tensorflow 安装干净,就像在 tensorflow.org 页面上一样,并且我能够执行 $ source bin/activate 以获得 tensorflow 提示,但我无法在 python 中导入包。这是我得到的:

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

我查看了关于 tensorflow 的常见问题部分,并搜索了上面的 ImportError,但到目前为止都没有成功。我想知道这是否是 Error in python after 'import tensorflow': TypeError: __init__() got an unexpected keyword argument 'syntax' 中提到的 protobuf 问题.提前致谢。

最佳答案

问题似乎是 TensorFlow 的二进制分发与 Mac OS X 10.8 不兼容。错误消息的相关部分是这个:

Symbol not found: ___sincos_stret

根据 various sources ,这是在 10.8 (Mavericks) 上使用为较新版本的 Mac OS X 编译的二进制文件时的一个已知问题,因为符号 ___sincos_stret 未在该版本操作系统的标准库中定义。

要解决此问题,您需要 (i) 升级到 Mac OS X 10.9 或更高版本,(ii) 按照 install from source 的说明进行操作,或 (iii) 使用 Docker .

关于Python 无法将 tensorflow 导入 Mac OS X 10.8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33644635/

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