PiP Install TensorFlow 报错*** is not a supported wheel on this platform.

原文转载于:https://www.jianshu.com/p/d3bd17953862?from=timeline&isappinstalled=0

最近在琢磨琢磨TensorFlow,刚起步,在此记下自己碰到的问题。

一、安装Python

注意:
1、机器必须是64位的,TensorFlow不支持32位!TensorFlow不支持32位!TensorFlow不支持32位!
2、Python必须装64位的!

我的版本安装的Python 3.5.3,一开始,无脑安装的32位的Python,死活装不上TensorFlow,一直报错:** is not a supported wheel on this platform.找到这里才知道TensorFlow不支持32位的,就尝试着更换成Python 64位,才终于装上

二、下载TensorFlow

如果直接使用 pip install --upgrade tensorflow由于国内网络问题,会导致下载不下来,所以可以在国内镜像去下载,我这里选的阿里云的镜像。我没使用文章后面的方法,因为下不下来,所以我是手动下载的,在这里直接Ctrl + F搜索 tensorflow就可以找到下载地方了。

搜索TensorFlow

三、安装TensorFlow

安装命令pip install建议在PowerShell里面执行,我是在Git Bash内执行的,直接在下载到的TensorFlow目录下执行pip install --upgrade tensorflow-1.0.0-cp35-cp35m-win_amd64.whl期间会安装一些TensorFLow的依赖,同样的,可能安装失败。我的死办法就是手动下载,再安装。
如我的numpy安装失败了

Collecting numpy>=1.11.0 (from tensorflow==1.0.0)
  Downloading numpy-1.12.0-cp35-none-win_amd64.whl (7.7MB)
Exception:
Traceback (most recent call last):
  File "c:\python35-3\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 232, in _error_catcher
    yield
  File "c:\python35-3\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 314, in read
    data = self._fp.read(amt)

这里同样搜索numpy,下载在手动安装,这要注意依赖的版本,直接复制numpy-1.12.0-cp35-none-win_amd64.whl搜索一下就行:

搜索下载

手动安装成功:

$ pip install numpy-1.12.0-cp35-none-win_amd64.whl
Processing f:\tensorflow\numpy-1.12.0-cp35-none-win_amd64.whl
Installing collected packages: numpy
Successfully installed numpy-1.12.0

再次执行 pip install --upgrade tensorflow-1.0.0-cp35-cp35m-win_amd64.whl

$ pip install --upgrade tensorflow-1.0.0-cp35-cp35m-win_amd64.whl
Processing f:\tensorflow\tensorflow-1.0.0-cp35-cp35m-win_amd64.whl
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out. (read timeout=15)",)': /simple/numpy/
Requirement already up-to-date: numpy>=1.11.0 in c:\python35-3\lib\site-packages (from tensorflow==1.0.0)
Collecting six>=1.10.0 (from tensorflow==1.0.0)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting wheel>=0.26 (from tensorflow==1.0.0)
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Collecting protobuf>=3.1.0 (from tensorflow==1.0.0)
  Using cached protobuf-3.2.0-py2.py3-none-any.whl
Collecting setuptools (from protobuf>=3.1.0->tensorflow==1.0.0)
  Downloading setuptools-34.3.1-py2.py3-none-any.whl (389kB)
Collecting packaging>=16.8 (from setuptools->protobuf>=3.1.0->tensorflow==1.0.0)
  Downloading packaging-16.8-py2.py3-none-any.whl
Collecting appdirs>=1.4.0 (from setuptools->protobuf>=3.1.0->tensorflow==1.0.0)
  Downloading appdirs-1.4.2-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools->protobuf>=3.1.0->tensorflow==1.0.0)
  Downloading pyparsing-2.1.10-py2.py3-none-any.whl (56kB)
Installing collected packages: six, wheel, pyparsing, packaging, appdirs, setuptools, protobuf, tensorflow
  Found existing installation: setuptools 28.8.0
    Uninstalling setuptools-28.8.0:
      Successfully uninstalled setuptools-28.8.0
Successfully installed appdirs-1.4.2 packaging-16.8 protobuf-3.2.0 pyparsing-2.1.10 setuptools-34.3.1 six-1.10.0 tensorflow-1.0.0 wheel-0.29.0

四、测试安装结果

$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(22)
>>> print(sess.run(a + b))
32
>>>

到此,TensorFlow就算成功安装了,接下来,大家去成为Master吧!

参考:
1、让PIP源使用国内镜像,提升下载速度和安装成功率。



作者:H_彪
链接:https://www.jianshu.com/p/d3bd17953862
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

猜你喜欢

转载自blog.csdn.net/business122/article/details/80927297