【问题标题】:Installing tensorflow using pip within anaconda fails在 anaconda 中使用 pip 安装 tensorflow 失败
【发布时间】:2018-06-26 22:56:37
【问题描述】:

我有一个全新的 Anaconda 安装 (Python 3.6),我正在尝试在 Mac OS X High Sierra 上通过 pip 安装 tensorflow(如 here 所述)。

具体来说,我已经跑过:

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.1-py3-none-any.whl

输出如下:

Collecting tensorflow==1.4.1 from https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.1-py3-none-any.whl
      Using cached https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.1-py3-none-any.whl
    Collecting six>=1.10.0 (from tensorflow==1.4.1)
      Using cached six-1.11.0-py2.py3-none-any.whl
    Collecting wheel>=0.26 (from tensorflow==1.4.1)
      Using cached wheel-0.30.0-py2.py3-none-any.whl
    Collecting numpy>=1.12.1 (from tensorflow==1.4.1)
      Using cached numpy-1.14.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
    Collecting protobuf>=3.3.0 (from tensorflow==1.4.1)
      Using cached protobuf-3.5.1-py2.py3-none-any.whl
    Collecting tensorflow-tensorboard<0.5.0,>=0.4.0rc1 (from tensorflow==1.4.1)
      Using cached tensorflow_tensorboard-0.4.0rc3-py3-none-any.whl
    Collecting enum34>=1.1.6 (from tensorflow==1.4.1)
      Using cached enum34-1.1.6-py3-none-any.whl
    Collecting setuptools (from protobuf>=3.3.0->tensorflow==1.4.1)
      Using cached setuptools-38.4.0-py2.py3-none-any.whl
    Collecting html5lib==0.9999999 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached html5lib-0.9999999.tar.gz
    Collecting markdown>=2.6.8 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached Markdown-2.6.11-py2.py3-none-any.whl
    Collecting bleach==1.5.0 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached bleach-1.5.0-py2.py3-none-any.whl
    Collecting werkzeug>=0.11.10 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow==1.4.1)
      Using cached Werkzeug-0.14.1-py2.py3-none-any.whl
    Building wheels for collected packages: html5lib
      Running setup.py bdist_wheel for html5lib ... done
      Running setup.py clean for html5lib
    Failed to build html5lib
    Installing collected packages: six, wheel, numpy, setuptools, protobuf, html5lib, markdown, bleach, werkzeug, tensorflow-tensorboard, enum34, tensorflow
      Running setup.py install for html5lib ... error
        Complete output from command /Users/mcewen/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/Users/mcewen/pip-build-r4d_y_ei/html5lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record ./pip-62mbr8ng-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib
        creating build/lib/html5lib
        copying html5lib/inputstream.py -> build/lib/html5lib
        copying html5lib/sanitizer.py -> build/lib/html5lib
        copying html5lib/constants.py -> build/lib/html5lib
        copying html5lib/html5parser.py -> build/lib/html5lib
        copying html5lib/__init__.py -> build/lib/html5lib
        copying html5lib/ihatexml.py -> build/lib/html5lib
        copying html5lib/tokenizer.py -> build/lib/html5lib
        copying html5lib/utils.py -> build/lib/html5lib
        creating build/lib/html5lib/filters
        copying html5lib/filters/_base.py -> build/lib/html5lib/filters
        copying html5lib/filters/sanitizer.py -> build/lib/html5lib/filters
        copying html5lib/filters/inject_meta_charset.py -> build/lib/html5lib/filters
        copying html5lib/filters/__init__.py -> build/lib/html5lib/filters
        copying html5lib/filters/alphabeticalattributes.py -> build/lib/html5lib/filters
        copying html5lib/filters/optionaltags.py -> build/lib/html5lib/filters
        copying html5lib/filters/lint.py -> build/lib/html5lib/filters
        copying html5lib/filters/whitespace.py -> build/lib/html5lib/filters
        creating build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/_base.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/pulldom.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/genshistream.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/__init__.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/lxmletree.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/etree.py -> build/lib/html5lib/treewalkers
        copying html5lib/treewalkers/dom.py -> build/lib/html5lib/treewalkers
        creating build/lib/html5lib/serializer
        copying html5lib/serializer/htmlserializer.py -> build/lib/html5lib/serializer
        copying html5lib/serializer/__init__.py -> build/lib/html5lib/serializer
        creating build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/_base.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/etree_lxml.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/__init__.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/etree.py -> build/lib/html5lib/treebuilders
        copying html5lib/treebuilders/dom.py -> build/lib/html5lib/treebuilders
        creating build/lib/html5lib/treeadapters
        copying html5lib/treeadapters/sax.py -> build/lib/html5lib/treeadapters
        copying html5lib/treeadapters/__init__.py -> build/lib/html5lib/treeadapters
        creating build/lib/html5lib/trie
        copying html5lib/trie/_base.py -> build/lib/html5lib/trie
        copying html5lib/trie/datrie.py -> build/lib/html5lib/trie
        copying html5lib/trie/__init__.py -> build/lib/html5lib/trie
        copying html5lib/trie/py.py -> build/lib/html5lib/trie
        running install_lib
        running install_egg_info
        running egg_info
        writing html5lib.egg-info/PKG-INFO
        writing dependency_links to html5lib.egg-info/dependency_links.txt
        writing requirements to html5lib.egg-info/requires.txt
        writing top-level names to html5lib.egg-info/top_level.txt
        reading manifest file 'html5lib.egg-info/SOURCES.txt'
        writing manifest file 'html5lib.egg-info/SOURCES.txt'
        removing '/Users/mcewen/anaconda3/lib/python3.6/site-packages/html5lib-0.9999999-py3.6.egg-info' (and everything under it)
        Copying html5lib.egg-info to /Users/mcewen/anaconda3/lib/python3.6/site-packages/html5lib-0.9999999-py3.6.egg-info
        running install_scripts
        writing list of installed files to './pip-62mbr8ng-record/install-record.txt'
        error: [Errno 2] No such file or directory: './pip-62mbr8ng-record/install-record.txt'

        ----------------------------------------
    Command "/Users/mcewen/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/Users/mcewen/pip-build-r4d_y_ei/html5lib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record ./pip-62mbr8ng-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /Users/mcewen/pip-build-r4d_y_ei/html5lib/

我怀疑这可能是 pip 问题而不是 tensorflow 问题,但一直未能找到解决方案。非常欢迎任何帮助!

【问题讨论】:

  • 好像写和读都不行。你可以试试sudo pip install
  • 感谢您的建议。 sudo pip 选择根环境,我想在单独的环境中执行此操作。另外,sudo 是否推荐与 conda 一起使用?
  • 似乎html5lib 是唯一的源包 - 您可以尝试通过conda install -c anaconda html5lib 单独安装它,以避免使用setuptools 从源代码构建它,然后重试安装命令。
  • 谢谢@hoefling。按照您的建议安装了html5lib,但似乎仍然出现相同的错误。出于某种原因,当我在原始消息中运行pip install 命令时,它仍然尝试安装html5lib
  • 现在正在运行conda list html5lib 我看到以下html5lib 1.0.1 py36h2f9c1c0_0 anaconda html5lib 0.9999999 &lt;pip&gt;

标签: python tensorflow pip anaconda conda


【解决方案1】:

在我的 Mac 上安装 tensorflow 时也遇到了很多问题。

最后我这样做了,它成功了:我按照 tensorflow 网站的命令,但没有正常工作。

另外,在同一个站点,sudo 也可以使用。

  1. 转到 Ananconda Navigator,单击 Environments(左侧菜单),然后 子菜单上的创建按钮。输入名称(“Tensorflow”将是我的 选择)
  2. 在右侧较大的框架中,从下拉列表中全选,输入 tensorflow 在 Search 文本框中,那么一些 tensorflow 项应该 出现。
  3. 选择tensorflow,点击右下角的Apply。

注意:现在我有两个环境,“root”和“tensorflow”。我在点击 Python IDE (Spyder) 之前选择了 tensorflow。

不确定这是否是您要查找的内容: anaconda-navigator-tensorflow-install

【讨论】:

    猜你喜欢
    • 2021-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-25
    • 2017-09-05
    • 2018-12-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多