在 Windows 上使用 Pip Python 安装 TensorFlow

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41317928/
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:47:16  来源:igfitidea点击:

Installing TensorFlow with Pip Python on Windows

pythontensorflow

提问by Brian Formento

Last month they released tensor-flow comparability with windows. Looking at the docs I've installed python 3.6 and run

上个月,他们发布了与 windows 的张量流可比性。查看我已安装 python 3.6 并运行的文档

pip install tensorflow-gpu 

but it doesn't find it and therefore doesn't install it.

但它没有找到它,因此没有安装它。

could not find a version that satisfies the requirements tensorflow-gpu(from versions)

Am I missing something basic? How can I fix or circumvent this?

我错过了一些基本的东西吗?我该如何解决或规避这个问题?

回答by mrry

A stable release of Python 3.6 for Windows became available on 12/23/2016, and we have not yet built TensorFlow packages for that version. (We will look into doing this after the holidays.) For now, your best options are:

适用于 Windows 的 Python 3.6 稳定版本于 2016 年 12 月 23 日发布,我们尚未为该版本构建 TensorFlow 包。(我们将在假期后考虑这样做。)目前,您最好的选择是:

  1. Downgrade to Python 3.5 (64-bit version), which the pre-built packages support.
  2. Try building TensorFlow from source.
  1. 降级到预构建包支持的 Python 3.5(64 位版本)。
  2. 尝试从源代码构建 TensorFlow

回答by Amit Kumar

Here is what i did to get tensorflow working with windows.

这是我为使 tensorflow 与 Windows 一起工作所做的工作。

Downloadpython 3.5.0 (64 bit from Python Releases for Windows) Install it and check python version by running below command in cmd:

下载python 3.5.0(来自Python Releases for Windows 的64 位)安装它并通过在 cmd 中运行以下命令来检查 python 版本:

python --version
Python 3.5.0

Then run below command to upgrade pip to latest

然后运行以下命令将pip升级到最新

python -m pip install --upgrade pip

Now install tensorflow using pip

现在使用 pip 安装 tensorflow

pip install tensorflow

That's it you have installed tensorflow on windows. Below image shows what happens when you type above commands enter image description here

就是这样,您已经在 Windows 上安装了 tensorflow。下图显示了当您键入上述命令时会发生什么 在此处输入图片说明

Exampleto verify tensorflow is working.

验证 tensorflow 是否正常工作的示例

$ python
...
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

回答by Moondra

I think you have to install Python 3.5 not 3.6. I'm having the same problem.

我认为您必须安装 Python 3.5 而不是 3.6。我有同样的问题。