在 windows 中使用 Pip Python 3.5 anaconda 安装 tensorflow

Installing tensorflow with Pip Python 3.5 anaconda in windows

我正在尝试在我的 Windows 7 64 位计算机上安装 Tensorslow。

我已经用 Python 3.5 安装了 Anaconda。

之后我做了 conda install theano

成功完成。
conda install mingw libpython
成功完成。
pip install tensorflow
错误

我无法像安装这些其他软件包那样安装 Tensorflow。我错过了一些基本的东西吗?

好的,我已经更新了说明:

*Launch your Anaconda CMD as Admin
#if tensorflow virtual env has been created, remove it first
conda remove --name tensorflow --all
conda create -n tensorflow  --python=3.5 anaconda
activate tensorflow
conda install spyder
conda install ipython
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
spyder

windows 上的 Tensorflow 仅适用于 Python 3.5 64 位版本,我不知道为什么不适用于 Python > 3.5。试试这个

 conda create --name newEnv python=3.5
 activate newEnv
 (newEnv)C:> pip install tensorflow

这会在该特定环境中安装 Tensorflow。用于测试 运行

 (newEnv)C:> python
 >>>import tensorflow as tf
 >>>hello = tf.constant('Hello Tensorflow!')
 >>>sess = tf.Session()
 >>>sess.run(hello)

它应该 运行 没有任何错误输出“Hello Tensorflow”。在 Windows 10 上用 python 3.5 64 位测试它并安装了 tensorflow 1.0.1 cpu 版本.

对于Windows 10(使用NVidia 840M GPU

如果您有不同的 GPU,请检查 here 以确保您的计算数量 > 3.0。我的 GPU 有 5.0

主要遵循 official install instructions and steps from Stack Overflow Answer

的说明

我发现大多数答案都没有结合全新安装的完整安装。

先配置机器

  1. Download Anaconda-Windows Link 下载并安装 Anaconda
    • 以用户身份安装 Anaconda(我没有测试以管理员身份安装)
  2. 下载cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0
    • 需要输入您的电子邮件地址并注册。
    • 解压缩此文件夹并将 */cuda/bin 文件夹添加到您的 %PATH%
  3. 安装NVIDIA Cuda Version 8 for Windows 10
    • 还要确保它在你的路径中
  4. 检查丢失的 DLL:如果 where MSVCP140.DLL returns 没有,您可能需要将其添加到路径或找到它 here
  5. 打开Anaconda CMD(具有admin权限)

现在使用 conda 安装并测试安装

在 Anaconda CMD 中(使用管理员):

conda create -n tensorflow python=3.5 anaconda
activate tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl

在Python中:

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

同时使用 中的代码进一步确认您使用的是 GPU