使用Python35在Windows 10中安装Tensorflow

时间:2017-04-19 21:52:03

标签: windows python-3.x tensorflow installation

我想在Windows 10中使用Tensorflow(仅支持CPU)。我尝试使用以下命令来使用pip安装但不起作用。任何想法如何解决这个问题?

C:/Python35/Scripts/pip install --upgrade tensorflow

在Comman Prompt中运行此命令我收到以下错误:

Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

我也尝试过使用pip3或URL安装:

    C:\>C:/Python35/Scripts/pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_amd64.whl
tensorflow-1.0.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.

但他们都没有奏效。

5 个答案:

答案 0 :(得分:1)

anaconda默认基于python 3.6而不是支持tensorflow的3.5xx。按照此链接中的指南进行操作:http://www.stefangordon.com/install-tensorflow-in-anaconda-on-windows/

答案 1 :(得分:0)

有一天,当pip版本过期时,我遇到了这个问题。在控制台中键入pip --version时,您有什么版本?

我建议运行pip install --upgrade pip将其更新到最新版本,然后重试。

答案 2 :(得分:0)

重新安装Python35并使用以下软件包: https://pypi.python.org/pypi/tensorflow

使用命令:

pip install "tensorflow-1.1.0rc2-cp35-cp35m-win_amd64.whl"

我能够在Windows上正确运行张量流。运行示例Tensorflow代码时可能会收到多个警告,例如:

2017-04-19 16:35:22.533979: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 2017-04-19 16:35:22.534756: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations. 2017-04-19 16:35:22.535027: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. 2017-04-19 16:35:22.535245: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-04-19 16:35:22.535462: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-04-19 16:35:22.535680: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-04-19 16:35:22.536664: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-04-19 16:35:22.536925: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. b'Hello, TensorFlow!'

要解决此问题,您可以使用以下代码来消除来自TF的警告:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

答案 3 :(得分:0)

pip版本应该是> 9 尝试升级点数:

python -m pip install -U pip

答案 4 :(得分:0)

Tensorflow的最新库不适用于win64上的最新python,你需要降级到Python 3.5.x

在win7 Enterprise(64位,Intel i5)上测试:

devlab@Ubuntu19 ~/Downloads
$ python --version
Python 3.5.3


devlab@Ubuntu19 ~/Downloads
$ pip install tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
Processing c:\users\xt21966\downloads\tensorflow-1.1.0-cp35-cp35m-
win_amd64.whl
Collecting six>=1.10.0 (from tensorflow==1.1.0)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting protobuf>=3.2.0 (from tensorflow==1.1.0)
Downloading protobuf-3.3.0.tar.gz (271kB)
Collecting wheel>=0.26 (from tensorflow==1.1.0)
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
Collecting werkzeug>=0.11.10 (from tensorflow==1.1.0)
Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
Collecting numpy>=1.11.0 (from tensorflow==1.1.0)
Downloading numpy-1.12.1-cp35-none-win_amd64.whl (7.7MB)
Requirement already satisfied: setuptools in 
c:\users\xt21966\appdata\local\programs\python\python35\lib\site-packages 
(from protobuf>=3.2.0->tensorflow==1.1.0)
Installing collected packages: six, protobuf, wheel, werkzeug, numpy, 
tensorflow
Running setup.py install for protobuf: started
Running setup.py install for protobuf: finished with status 'done'
Successfully installed numpy-1.12.1 protobuf-3.3.0 six-1.10.0 tensorflow-1.1.0 werkzeug-0.12.2 wheel-0.29.0