简体   繁体   English

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

[英]Installing TensorFlow on Windows (Python 3.6.x)

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 3.6.0b4 (default, Nov 22 2016, 05:30:12) [MSC v.1900 64 bit (AMD64)] on win32

pip: 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 tensorflow and pip install tensorflow-gpu like suggested here . 顺便说一句,我也试过像这里建议的pip install tensorflowpip install tensorflow-gpu I got the following output: 我得到以下输出:

 > 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 

Update 15.11.2017 更新于15.11.2017

It seems that by now it is working like one would expect. 似乎到现在它的工作方式与人们期望的一样。 Running the following commands using the following pip and python version should work. 使用以下pippython版本运行以下命令应该有效。


Installing with Python 3.6.x 使用Python 3.6.x进行安装


Version

Python : 3.6.3 Python :3.6.3
pip : 9.0.1 点数 :9.0.1


Installation Commands 安装命令

The following commands are based of the following installation guide here . 下面的命令是基于以下安装指南这里

using cmd 使用cmd

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

using Anaconda 使用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 附加信息

A list of common installation problems can be found 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 ! 使用版本3.5.2
Neither 3.5.1 nor 3.6.x seem to work at the moment. 目前3.5.1和3.6.x似乎都不起作用。

Versions: 版本:

Python 3.5.2 pip 8.1.1 .. (python 3.5) 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 

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

After searching a lot and trying to install and reinstall Python, i found the solution was very simple 经过大量搜索并尝试安装并重新安装Python后,我发现解决方案非常简单

use the following for windows 对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

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. Tensorflow现在可以使用python 3.6.4,不使用3.6.4之后的python构建,最重要的是tensorflow在Python 3.7.2上不起作用。 You can download 3.6.4 for windows from here python 3.6.4 . 你可以从这里下载3.6.4 for windows python 3.6.4

Then just simply run pip install tensorflow-gpu 然后只需运行pip install tensorflow-gpu即可

At the time of this writing, there is no official support for TensorFlow with Python 3.6 on Windows. 在撰写本文时,Windows上的Python 3.6没有官方支持TensorFlow。 The recommendation is to build TensorFlow yourself. 建议自己构建TensorFlow。

Some people have already done this and provide *.whl files that you can directly install with pip. 有些人已经这样做并提供了* .whl文件,你可以用pip直接安装。 These are unofficial, so use at your own risk: 这些是非官方的,因此使用风险由您自行承担:

You can simply download them and install them with pip install <filename>.whl . 您只需下载它们并使用pip install <filename>.whl安装它们。

See also this GitHub comment . 另见GitHub评论

I was having Python 3.6 and was facing the issue as " No module named tensorflow " on "pip install tensorflow". 我正在使用Python 3.6并且在“pip install tensorflow”上面临着“ 没有名为tensorflow的模块 ”的问题。 Turned out as my machine was of 64 bit while the Python 3.6 version installed was for 32 bit . 原来我的机器是64位,而安装的Python 3.6版本是32位 Uninstalled it, reinstalled the Python 3.6 x64 version, pip installed tensorflow, problem solved. 卸载它,重新安装了Python 3.6 x64版本,pip安装了tensorflow,问题解决了。

Tensorflow is now supported on Python 3.6. Python 3.6现在支持Tensorflow。 Just make sure that the Python installation is 64 bit on a 64 bit machine and that pip is the latest ( pip install --upgrade pip ). 只需确保在64位计算机上安装Python是64位,并且该pip是最新的( pip install --upgrade pip )。

After that ( pip install --upgrade tensorflow ) works like a charm. 之后( pip install --upgrade tensorflow )就像魅力一样。

Tensorflow indeed supports Python 3.6.X version, but only for 64-bit architecture. Tensorflow确实支持Python 3.6.X版本,但仅适用于64位架构。 Here is the link where you can download Python 3.6.X 64-bit version 是您可以下载Python 3.6.X 64位版本的链接

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

Tensorflow in Now supporting Python 3.6.0 .....I have successfully installed the Tensorflow for Python 3.6.0 Tensorflow现在支持Python 3.6.0 .....我已经成功安装了Tensorflow for Python 3.6.0
Using this Simple Instruction // pip install -- tensorflow 使用这个简单的指令// pip install - tensorflow

[enter image description here][1] [在此处输入图像说明] [1]
[1]: https://i.stack.imgur.com/1Y3kf.png [1]: https//i.stack.imgur.com/1Y3kf.png

Installing collected packages: protobuf, html5lib, bleach, markdown, tensorflow-tensorboard, tensorflow 安装收集的软件包:protobuf,html5lib,漂白,降价,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 成功安装了bleach-1.5.0 html5lib-0.9999999 markdown-2.6.9 protobuf-3.4.0 tensorflow-1.3.0 tensorflow-tensorboard-0.1.5

Same issue with you . 和你一样的问题。

py3.6x win10 pro x64 pip 9.0.1 py3.6x win10 pro x64 pip 9.0.1

Issue message 发出消息
"Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow" “找不到满足需求张量流的版本(来自版本:)没有为tensorflow找到匹配的分发”

Maybe you can try py3.5 也许你可以尝试py3.5

Windows batch file for installing TensorFlow and Python 3.5 on Windows. 用于在Windows上安装TensorFlow和Python 3.5的Windows批处理文件。 The issue is that as of this date, TensorFlow is not updated to support Python 3.6+ and will not install. 问题是截至此日期,TensorFlow未更新为支持Python 3.6+且无法安装。 Additionally, many systems have an incompatible version of Python. 此外,许多系统都具有不兼容的Python版本。 This batch file should create a compatible environment without effecting other Python installs. 此批处理文件应创建兼容的环境,而不会影响其他Python安装。 See REM comments for assumptions. 有关假设,请参阅REM注释。

REM download Anaconda3-4.2.0-Windows-x86_64.exe (contains python 3.5) from https://repo.continuum.io/archive/index.html
REM Assumes download is in %USERPROFILE%\Downloads
%USERPROFILE%\Downloads\Anaconda3-4.2.0-Windows-x86_64.exe

REM change path to use Anaconda3 (python 3.5).
PATH %USERPROFILE%\Anaconda3;%USERPROFILE%\Anaconda3\Scripts;%USERPROFILE%\Anaconda3\Library\bin;%PATH%

REM update pip to 9.0 or later (mandatory)
python -m pip install --upgrade pip

REM tell conda where to load tensorflow
conda config --add channels conda-forge

REM elevate command (mandatory) and install tensorflow - use explicit path to conda %USERPROFILE%\Anaconda3\scripts\conda
powershell.exe -Command start-process -verb runas cmd {/K "%USERPROFILE%\Anaconda3\scripts\conda install tensorflow"}

Be sure the above PATH is used when invoking TensorFlow. 确保在调用TensorFlow时使用上述PATH。

Follow these steps to install ternsorflow : 请按照以下步骤安装ternsorflow

(step 1)   conda create -n py35 python=3.5
(step 2)   activate py35
(step 3)   conda create -n tensorflow
(step 4,only for GPU)   pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl

Just found Tensorflow 1.1 for python 3.6 on windows x64 (including GPU version, but i tested only cpu): http://www.lfd.uci.edu/~gohlke/pythonlibs/#tensorflow . 刚刚在Windows x64上找到了Tensorflow 1.1 for python 3.6 (包括GPU版本,但我只测试了cpu): http//www.lfd.uci.edu/~gohlke/pythonlibs/#tensorflow Unofficial apparently, but worked for me when I import tensorflow or tflearn in my code. 显然是非官方的,但是当我在我的代码中导入tensorflow或tflearn时,却为我工作。 They have scipy for windows there and bunch of other packages. 他们有窗户scipy和其他一揽子包。

For some reason pip install URL returns code 404, so the installation would be the following: 由于某种原因,pip install URL返回代码404,因此安装将如下所示:

1) Download protobuf whl package from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/vu0h7y4r/protobuf-3.3.0-py3-none-any.whl 1)从这里下载protobuf whl包: http ://www.lfd.uci.edu/~gohlke/pythonlibs/vu0h7y4r/protobuf-3.3.0-py3-none-any.whl

2) pip install {DownloadFolder}\\protobuf-3.3.0-py3-none-any.whl 2) pip install {DownloadFolder}\\protobuf-3.3.0-py3-none-any.whl

3) Download TF whl file: http://www.lfd.uci.edu/~gohlke/pythonlibs/vu0h7y4r/tensorflow-1.1.0-cp36-cp36m-win_amd64.whl 3)下载TF whl文件: http ://www.lfd.uci.edu/~gohlke/pythonlibs/vu0h7y4r/tensorflow-1.1.0-cp36-cp36m-win_amd64.whl

4) pip install {DownloadFolder}\\tensorflow-1.1.0-cp36-cp36m-win_amd64.whl 4) pip install {DownloadFolder}\\tensorflow-1.1.0-cp36-cp36m-win_amd64.whl

It worked for me. 它对我有用。

For someone w/ TF 1.3: 对于TF / 1.3的人:

Current TensorFlow 1.3 support Python 3.6 , and then you need cuDNN 6 (cudnn64_6.dll) 当前的TensorFlow 1.3支持Python 3.6 ,然后你需要cuDNN 6 (cudnn64_6.dll)

Based on Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found and this: https://github.com/tensorflow/tensorflow/issues/7705 基于Windows上的Tensorflow - ImportError:DLL加载失败:找不到指定的模块 ,这个: https//github.com/tensorflow/tensorflow/issues/7705

On 2/22/18, when I tried the official recommendation: 18/22/18,当我尝试官方推荐时:

pip3 install --upgrade tensorflow

I got this error 我收到了这个错误

Could not find a version that satisfies the requirement tensorflow

But instead using 而是使用

pip install --upgrade tensorflow

installed it ok. 安装好了。 (I ran it from the ps command prompt.) (我从ps命令提示符下运行它。)

I have 64-bit windows 10, 64-bit python 3.6.3, and pip3 version 9.0.1. 我有64位Windows 10,64位python 3.6.3和pip3版本9.0.1。

Tensor flow on 32 bit machine. 32位机器上的张量流量。

There is no official build out for 32 bit, but still there is a workaround for that, follow the link http://cudamusing.blogspot.in/2015/11/building-tensorflow-for-jetson-tk1.html . 32位没有官方版本,但仍然有一个解决方法,请点击链接http://cudamusing.blogspot.in/2015/11/building-tensorflow-for-jetson-tk1.html I would not suggest doing this big reason is its not possible to follow the process every time there is a change in official tensor flow code. 我不建议这样做的重要原因是,每当官方张量流程代码发生变化时,都无法遵循这个过程。

I had the same issue, but I followed the following steps:- 我有同样的问题,但我按照以下步骤: -

  1. I had Python 3.6.5 (32 bit) installed on my desktop, but from all the research I did, I could conclude that Tensorflow runs only on Python 3.5x or 3.6x 64 bit versions. 我在桌面上安装了Python 3.6.5(32位),但是从我做过的所有研究中,我可以得出结论,Tensorflow仅在Python 3.5x或3.6x 64位版本上运行。 So I uninstalled it and Installed Python 3.5.0 instead. 所以我将其卸载并安装了Python 3.5.0。
  2. I ran Python 3.5.0 as an administrator. 我以管理员身份运行Python 3.5.0。 This step is necessary for Windows as, without it, the system doesn't get any privileges and can't install tensorflow. 对于Windows,此步骤是必需的,没有它,系统不会获得任何权限,也无法安装tensorflow。
  3. Install Pip3 using command:- python -m pip install --upgrade pip 使用命令安装Pip3: - python -m pip install --upgrade pip
  4. Once the newest version (10.0.1 in my case) is installed, you can install tensorflow usin command:- pip3 install --upgrade tensorflow 一旦安装了最新版本(在我的情况下为10.0.1),您可以安装tensorflow usin命令: - pip3 install --upgrade tensorflow
  5. Your tensorflow will be downloaded and installed. 您的张量流将被下载并安装。 For further help on how to run tensorflow programs, go to https://www.tensorflow.org/get_started/premade_estimators 有关如何运行tensorflow程序的进一步帮助,请访问https://www.tensorflow.org/get_started/premade_estimators

https://i.stack.imgur.com/1Y3kf.png https://i.stack.imgur.com/1Y3kf.png

pip install -- tensorflow This worked for me for this version of python Python 3.6.4 : : Anaconda, Inc. pip install - tensorflow这对我这个版本的python Python 3.6.4起作用了:: Anaconda,Inc。

Tensorflow is not compatible with python3.7 and spyder3.3.1 Tensorflow与python3.7和spyder3.3.1不兼容

To work with stable tensorflow version 使用稳定的tensorflow版本

follow the procedure 按照程序

windows-->search-->Anaconda prompt-->right click -->click Run as adminstrator windows - >搜索 - > Anaconda提示 - >右键单击 - >单击以管理员身份运行

Below command create the virtual environment which does not disturb existing projects 在命令下面创建不会干扰现有项目的虚拟环境

conda create -n projectname 

Below command activates your virtual environment within this directory installed package will not disturb your existing project. 下面的命令会在此目录中激活您的虚拟环境,安装包不会干扰您现有的项目。

activate projectname

Below command installs python 3.6.7 and spyder 3.2.3 as well 下面的命令也安装了python 3.6.7和spyder 3.2.3

conda install spyder=3.2.3

Below mentioned tensorflow version works without any error. 下面提到的tensorflow版本没有任何错误。 As per your need, you can install tensorflow version specifically. 根据您的需要,您可以专门安装tensorflow版本。

pip install tensorflow==1.3.0

To open spyder 打开spyder

spyder

To exit form Virtual environment 退出表单虚拟环境

deactivate

For the GPU version, see my answer here . 对于GPU版本,请在此处查看我的答案。

In short, install Anaconda, then open an anaconda terminal and type conda create --name tf_gpu tensorflow-gpu 简而言之,安装Anaconda,然后打开一个anaconda终端并输入conda create --name tf_gpu tensorflow-gpu

You are then free to use the conda environment tf_gpu 然后您可以自由使用tf_gpu环境tf_gpu

Tensor flow has only support for python 2.7 3.4 3.5 Other python versions are not supported So you please install the supported python version and try it again. Tensor flow只支持python 2.7 3.4 3.5不支持其他python版本所以你请安装支持的python版本并再试一次。 The official link is https://www.tensorflow.org/install/install_linux#InstallingAnaconda It provides how to install it with anaconda . 官方链接是https://www.tensorflow.org/install/install_linux#InstallingAnaconda它提供了如何使用anaconda安装它。 This will help you 这会对你有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM