在anaconda中使用pip安装tensorflow失败

时间:2018-01-17 23:26:56

标签: python tensorflow pip anaconda conda

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

具体来说,我跑了:

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/

我怀疑这可能是一个小问题,而不是张量流问题,但是还没有能够找到解决方案。任何帮助都非常欢迎!

1 个答案:

答案 0 :(得分:0)

我在mac上安装tensorflow时遇到很多问题。

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

另外,在同一个网站上,sudo可以使用。

  1. 转到Ananconda Navigator,单击“环境”(左侧菜单),然后 在子菜单上创建按钮。输入一个名字(&#34; Tensorflow&#34;将是我的 选择)
  2. 在右侧较大的框架上,从下拉列表中选择全部,输入 在搜索文本框中的tensorflow,然后一些tensorflow项应该 出现。
  3. 选择tensorflow,单击右下角的Apply。
  4. 注意:现在我有两个环境,&#34; root&#34;和&#34; tensorflow&#34;。我在点击Python IDE(Spyder)之前选择了tensorflow。

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