【问题标题】:unable to pip install tensorflow (anymore)无法 pip 安装 tensorflow(不再)
【发布时间】:2019-05-26 14:06:24
【问题描述】:

直到最近我在 windows 上使用 python 3.6.7 时才能够安装 tensorflow 1.5.0 包。现在我不能,而且从下面的“来自版本”的消息看来,根本没有可用的 tensorflow 包。

支持最近停止了吗?

考虑到 micha137 和 hoefling 的 cmets 的一些附加信息:

在 linux 中,tensorflow 有多种版本。我试过的 pip 版本 9.0.3、10.0.1 和 18.1 就是这种情况。

例如:

(env3)xxx@xxx-linux:/local/mnt/workspace/tmp$ pip install tensorflow==
Collecting tensorflow==
  Could not find a version that satisfies the requirement tensorflow== (from versions: 0.12.0rc0, 0.12.0rc1, 0.12.0, 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0)
No matching distribution found for tensorflow==
(env3)xxx@xxx-linux:/local/mnt/workspace/tmp$ pip --version
pip 18.1 from /local/mnt/workspace/tmp/env3/lib/python3.4/site-packages/pip (python 3.4)

根据合同,在 Windows 中:

C:\tmp>pip --version
pip 18.1 from c:\users\xxx\appdata\local\programs\python\python36-32\lib\site-packages\pip (python 3.6)

C:\tmp>pip install tensorflow==
Collecting tensorflow==
  Could not find a version that satisfies the requirement tensorflow== (from versions: )
No matching distribution found for tensorflow==

一些附加信息:

C:\tmp>pip install -vvv tensorflow. -
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Created temporary directory: C:\Users\xxx\AppData\Local\Temp\pip-ephem-wheel-cache-fmlkvkla
Created temporary directory: C:\Users\xxx\AppData\Local\Temp\pip-req-tracker-oijk67__
Created requirements tracker 'C:\\Users\\xxx\\AppData\\Local\\Temp\\pip-req-tracker-oijk67__'
Created temporary directory: C:\Users\xxx\AppData\Local\Temp\pip-install-tt2d7lx0
Cleaning up...
Removed build tracker 'C:\\Users\\xxx\\AppData\\Local\\Temp\\pip-req-tracker-oijk67__'
Invalid requirement: 'tensorflow.'

后面是冗长的回溯。

还有:

C:\tmp>python -c "from setuptools import pep425tags; print(pep425tags.get_supported()[0])"
c:\Users\xxx\AppData\Local\Programs\Python\Python36-32\lib\site-packages\setuptools\pep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
  warn=(impl == 'cp')):
c:\Users\xxx\AppData\Local\Programs\Python\Python36-32\lib\site-packages\setuptools\pep425tags.py:93: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
  warn=(impl == 'cp')):
('cp36', 'cp36m', 'win32')

【问题讨论】:

  • 请发布python -c "from setuptools import pep425tags; print(pep425tags.get_supported()[0])"pip install -vvv tensorflow的输出。
  • @hoefling 查看更新后的帖子。
  • 看起来你安装了 32 位 Python,你能检查一下吗? python -c "import sys; print('64 bit' if sys.maxsize > 2**32 else '32 bit')" Tensorflow 仅适用于 64 位分发。
  • @hoefling 谢谢!!!!不知何故,我偶然安装了 32 位版本。您想将此作为答案提供,以便我标记为已批准的答案吗?

标签: python windows tensorflow pip


【解决方案1】:

你可以试试list the available versions:

$ pip.exe install tensorflow==
Collecting tensorflow==
   Could not find a version that satisfies the requirement tensorflow== (from ver sions: 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7. 0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9 .0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0)
No matching distribution found for tensorflow==

【讨论】:

    【解决方案2】:

    根据输出判断

    python -c "from setuptools import pep425tags; print(pep425tags.get_supported()[0])"
    ('cp36', 'cp36m', 'win32')
    

    您拥有受支持的 Python 版本,但安装了 32 位发行版(平台标记为 win32;对于 Windows 上的 64 位 Python,它应该是 win_amd64)。 Tensorflow 仅适用于 64 位发行版(all the wheels on PyPI 具有平台标签,macosx_10_11_x86_64 用于 MacOS,manylinux1_x86_64 用于 Linux,win_amd64 用于 Windows)。安装 64 位 Python(例如来自 python-3.6.8-amd64.exe)就可以了。

    【讨论】: