Tensorflow导入问题mac

时间:2016-05-24 00:50:04

标签: python macos tensorflow deep-learning

我按照指示进行了

              https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#on-macosx

用于mac安装。

安装后我导航到python并尝试导入Tensorflow并遇到以下问题。

   (tensorflow) min:~ min$ python
   Python 2.7.2 (default, Oct 11 2012, 20:14:37)  
   [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on    darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import tensorflow as tf
   Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/Users/codeback/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
   from tensorflow.python import *
   File "/Users/codeback/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 29, in <module>
   import ctypes
  File "//anaconda/lib/python2.7/ctypes/__init__.py", line 10, in <module>
  from _ctypes import Union, Structure, Array
  ImportError: dlopen(/Users/codeback/tensorflow/lib/python2.7/lib-   dynload/_ctypes.so, 2): Symbol not found: __PyInt_AsInt
 Referenced from: /Users/codeback/tensorflow/lib/python2.7/lib-dynload/_ctypes.so
   Expected in: flat namespace
  in /Users/codeback/tensorflow/lib/python2.7/lib-dynload/_ctypes.so

伙计我是安装tensorflow的新手。所以我需要详细说明 谢谢

1 个答案:

答案 0 :(得分:2)

这似乎与pyenv有关。关注these instructions应该清理一切。

  

将更改恢复为pyenv将使现有的内置扩展模块再次运行,但无法解决pyenv更改旨在解决的问题:与预构建的Mac OS X和发布到PyPI的manylinux1轮文件的二进制兼容性。

     

在Linux上,以下命令将重建环境中的所有模块(不要直接针对您的系统Python运行它!):   $ pip freeze | pip install --ignore-installed --no-use-wheel -r /dev/stdin