在 Windows 上安装 TensorFlow (Python 3.6.x)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40884668/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 00:09:12  来源:igfitidea点击:

Installing TensorFlow on Windows (Python 3.6.x)

pythonpython-3.xinstallationtensorflow

提问by Tobias Würth

I'm trying to install TensorFlow on Windows.

我正在尝试在 Windows上安装TensorFlow

I tried to install it with pip, but I always get the same error message:

我尝试使用 安装它pip,但总是收到相同的错误消息:

... is not a supported wheel on this platform.

I first tried it with Python 3.5.1, now I upgraded to 3.6.0b4, but it makes no difference.

我首先用 Python 3.5.1 尝试过,现在我升级到3.6.0b4,但没有区别。



Python:

Python:

Python 3.6.0b4 (default, Nov 22 2016, 05:30:12) [MSC v.1900 64 bit (AMD64)] on win32

pip:

点:

pip 9.0.1 from ...\python\lib\site-packages (python 3.6)


To be exact, I tried the following two commands:

确切地说,我尝试了以下两个命令:

pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl

they output the following:

他们输出以下内容:

> tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.
> tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.

Does anyone know how to solve this problem? I'm not sure where I'm making a mistake.

有谁知道如何解决这个问题?我不确定我在哪里犯了错误。

Thanks!

谢谢!



Edit 1编辑 1

Btw, I also tried pip install tensorflowand pip install tensorflow-gpulike suggested here. I got the following output:

顺便说一句,我也尝试过pip install tensorflowpip install tensorflow-gpu喜欢这里的建议。我得到以下输出:

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

回答by Tobias Würth

Update 15.11.2017

2017 年 11 月 15 日更新

It seems that by now it is working like one would expect. Running the following commands using the following pipand pythonversion should work.

到目前为止,它似乎像人们预期的那样工作。使用以下pippython版本运行以下命令应该可以工作。



Installing with Python 3.6.x

使用 Python 3.6.x 安装



Version

版本

Python: 3.6.3
pip: 9.0.1

蟒蛇:3.6.3
:9.0.1



Installation Commands

安装命令

The following commands are based of the following installation guide here.

以下命令基于此处的以下安装指南。

using cmd

使用命令

C:> pip3 install --upgrade tensorflow // cpu
C:> pip3 install --upgrade tensorflow-gpu // gpu

using Anaconda

使用蟒蛇

C:> conda create -n tensorflow python=3.5 
C:> activate tensorflow
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow
(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow-gpu 

Additional Information

附加信息

可以找到常见安装问题的列表 here在这里

You can find an example console output of a successful tensorflow cpu installation here.

您可以在此处找到成功安装 tensorflow cpu 的控制台输出示例。



Old response:

旧回复

Okay to conclude; use version 3.5.2!
Neither 3.5.1 nor 3.6.x seem to work at the moment.

好的总结; 使用3.5.2版!
目前 3.5.1 和 3.6.x 似乎都不起作用。

Versions:

Python 3.5.2 pip 8.1.1 .. (python 3.5)

Commands:

// cpu
C:> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl

// gpu
C:> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl

版本:

Python 3.5.2 pip 8.1.1 .. (python 3.5)

命令:

// cpu
C:> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl

// gpu
C:> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl

回答by Darpan Dodiya

If you are using anaconda distribution, you can do the following to use python 3.5 on the new environnement "tensorflow":

如果您使用的是 anaconda 发行版,则可以执行以下操作以在新环境“tensorflow”上使用 python 3.5:

conda create --name tensorflow python=3.5
activate tensorflow
conda install jupyter
conda install scipy
pip install tensorflow
# or
# pip install tensorflow-gpu

It is important to add python=3.5 at the end of the first line, because it will install Python 3.5.

在第一行的末尾添加 python=3.5 很重要,因为它会安装 Python 3.5。

Source: https://github.com/tensorflow/tensorflow/issues/6999#issuecomment-278459224

来源:https: //github.com/tensorflow/tensorflow/issues/6999#issuecomment-278459224

回答by Lucky

After searching a lot and trying to install and reinstall Python, i found the solution was very simple

经过大量搜索并尝试安装和重新安装Python后,我发现解决方案非常简单

use the following for windows

使用以下窗口

python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

change to following on mac

在 mac 上更改为关注

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

for Anaconda use corresponding conda

对于 Anaconda 使用相应的 conda

回答by pranav surampudi

Tensorflow now works with python 3.6.4, don't use python builds that came after 3.6.4 and most importantly tensorflow doesn't work on Python 3.7.2. You can download 3.6.4 for windows from here python 3.6.4.

Tensorflow 现在适用于 python 3.6.4,不要使用 3.6.4 之后的 python 构建,最重要的是 tensorflow 不适用于 Python 3.7.2。你可以从这里下载 3.6.4 for windows python 3.6.4

Then just simply run pip install tensorflow-gpu

然后只需简单地运行 pip install tensorflow-gpu

回答by TheOperator

At the time of this writing, there is no official support for TensorFlow with Python 3.6 on Windows. The recommendation is to build TensorFlow yourself.

在撰写本文时,Windows 上还没有对带有 Python 3.6 的 TensorFlow 的官方支持。建议是自己构建 TensorFlow。

Some people have already done this and provide *.whl files that you can directly install with pip. These are unofficial, so use at your own risk:

有些人已经这样做了,并提供了 *.whl 文件,您可以直接使用 pip 安装。这些是非官方的,因此使用风险自负:

You can simply download them and install them with pip install <filename>.whl.

您可以简单地下载它们并使用pip install <filename>.whl.

See also this GitHub comment.

另请参阅此 GitHub 评论

回答by Rahul Agnihotri

I was having Python 3.6 and was facing the issue as "No module named tensorflow" on "pip install tensorflow". Turned out as my machine was of 64 bitwhile the Python 3.6 version installed was for 32 bit. Uninstalled it, reinstalled the Python 3.6 x64version, pip installed tensorflow, problem solved.

我使用的是 Python 3.6,并且在“pip install tensorflow”上面临“没有名为 tensorflow 的模块”的问题。结果证明我的机器是64 位的,而安装的 Python 3.6 版本是32 位的。卸载了,重新安装Python 3.6 x64版本,pip安装tensorflow,问题解决。

回答by brajesh jaishwal

Tensorflow is now supported on Python 3.6. Just make sure that the Python installation is 64 bit on a 64 bit machine and that pipis the latest (pip install --upgrade pip).

Python 3.6 现在支持 Tensorflow。只需确保 Python 安装在 64 位机器上是 64 位,并且pip是最新的 ( pip install --upgrade pip)。

After that (pip install --upgrade tensorflow) works like a charm.

之后 ( pip install --upgrade tensorflow) 就像一个魅力。

回答by Raj Bettaswamy

Tensorflow indeed supports Python 3.6.Xversion, but only for 64-bitarchitecture. Hereis the link where you can download Python 3.6.X 64-bit version

Tensorflow 确实支持 Python 3.6.X版本,但仅适用于64 位架构。是您可以下载 Python 3.6.X 64 位版本的链接

回答by ashwanidv100

Tensorflow in Now supporting Python 3.6.0 .....I have successfully installed the Tensorflow for Python 3.6.0
Using this Simple Instruction // pip install -- tensorflow

[enter image description here][1]
[1]: https://i.stack.imgur.com/1Y3kf.png

现在支持 Python 3.6.0 中的 Tensorflow ..... 我已经
使用这个简单的指令成功安装了 Python 3.6.0 的 Tensorflow // pip install -- tensorflow

[在此处输入图像描述][1]
[1]: https: //i.stack.imgur.com/1Y3kf.png

Installing collected packages: protobuf, html5lib, bleach, markdown, tensorflow-tensorboard, tensorflow
Successfully installed bleach-1.5.0 html5lib-0.9999999 markdown-2.6.9 protobuf-3.4.0 tensorflow-1.3.0 tensorflow-tensorboard-0.1.5

安装收集的包:protobuf、html5lib、漂白、markdown、tensorflow-tensorboard、tensorflow
成功安装了blade-1.5.0 html5lib-0.9999999 markdown-2.6.9 protobuf-3.4.0 tensorflow-1.3.0 tensorflow-tensorboard-0.1.1.

回答by Brian O'Donnell

For Pip installation on Windows and 64-bit Python 3.5:

对于 Windows 和 64 位 Python 3.5 上的 Pip 安装:

CPU only version:

仅 CPU 版本:

C:\> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl

For the GPU version:

对于 GPU 版本:

C:\> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl

References: Tensorflow installation issue on windows "tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl is not a supported wheel on th is platform.".

参考: Windows 上的 Tensorflow 安装问题“tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl 不是平台上支持的轮子。” .

https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html

https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html

Also see tensorflow not found in pip.

另请参阅pip 中未找到的 tensorflow