【问题标题】:Tensorflow importing issue macTensorFlow导入问题mac
【发布时间】:2016-05-24 00:50:03
【问题描述】:

我按照指示作为

              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 的新手。所以我需要详细解释 谢谢你

【问题讨论】:

    标签: python macos tensorflow deep-learning


    【解决方案1】:

    这似乎是 pyenv 的问题。关注these instructions 应该可以解决问题。

    恢复对 pyenv 的更改将使现有的内置扩展模块再次工作,但不会解决 pyenv 更改旨在解决的问题:与预构建的 Mac OS X 和发布到 PyPI 的许多 Linux1 轮文件的二进制兼容性。

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

    【讨论】:

    • 嗨,谢谢,但我对此很陌生。所以我只是把$ pip freeze | pip install --ignore-installed --no-use-wheel -r /dev/stdin 在我的 mac 终端上推荐?请给我具体的方向
    • pip freeze &gt; requirements.txt 然后pip install --ignore-installed --no-use-wheel -r requirements.txt
    • $ pip install --ignore-installed --no-use-wheel -r requirements.txt 弃用:--no-use-wheel 已弃用,将来将被删除。请改用 --no-binary :all: 。收集 alabaster==0.7.7(来自 -r requirements.txt(第 1 行)) 使用缓存的 alabaster-0.7.7.ta​​r.gz 收集 anaconda-client==1.4.0(来自 -r requirements.txt(第 2 行) )
    • 找不到满足要求 anaconda-client==1.4.0 的版本(来自 -r requirements.txt(第 2 行))(来自版本:1.1.1、1.2.2)否为 anaconda-client==1.4.0 找到匹配的分布(来自 -r requirements.txt(第 2 行))
    • @sayuri 是否还会出现完全相同的错误?您是否尝试过找到正确版本的 anaconda-client 并再次尝试安装?
    猜你喜欢
    • 2020-10-28
    • 2018-10-03
    • 2020-03-20
    • 2021-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多