TensorFlow至今发布已经一年多了,以前都是在linux上玩,前两天TensorFlow的windows版本面世了。忍不住就捣鼓装了下,其实在网速很好的情况下还是很方便安装的。
截止到今日(2016.12.6)只可以在python3的环境下安装,如下图所示:
我电脑安装有python3.5.2,和Anaconda3,是没问题的。如果网速不好的话,直接用pip安装些依赖包会很费时间,甚至中断,这里推荐看需要哪些依赖包,然后直接在国内的镜像(在simple文件夹里)上下载最新版,然后用电脑本地安装:
pipy国内镜像搜集的有:
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 华中理工大学
http://pypi.sdutlinux.org/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学
好了,开始安装:
1. 命令:
C:\Windows\system32>pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
报错:由于Anaconda3-4.2.0自带的是setuptools 27.2.0版本。查了下,现在最新版本是30.2.0。需要升级setuptools的版本。(需要说明的是,如果你不是anaconda,而是直接配置的python3的话, 就不会有下面的问题了,如果网速快的话,直接就可以装好了,如果不快,通过自行在上面提到的镜像中下载依赖包也可以解决的)
Collecting tensorflow-gpu==0.12.0rc0 from https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
Using cached https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
Requirement already up-to-date: protobuf==3.1.0 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: wheel>=0.26 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: six>=1.10.0 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: numpy>=1.11.0 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Collecting setuptools (from protobuf==3.1.0->tensorflow-gpu==0.12.0rc0)
Using cached setuptools-30.2.0-py2.py3-none-any.whl
Installing collected packages: tensorflow-gpu, setuptools
Found existing installation: setuptools 27.2.0
Cannot remove entries from nonexistent file d:\program files\anaconda3\lib\site-packages\easy-install.pth
- 命令:用pip升级setuptools
C:\Windows\system32>pip install setuptools --upgrade
依旧不行:
Collecting setuptools
Using cached setuptools-30.2.0-py2.py3-none-any.whl
Installing collected packages: setuptools
Found existing installation: setuptools 27.2.0
Cannot remove entries from nonexistent file d:\program files\anaconda3\lib\site-packages\easy-install.pth
换做使用conda升级
conda update setuptools
还是不行。
- 命令:那么就用conda remove掉setuptools
C:\Windows\system32>conda remove setuptools
无法移除
Fetching package metadata .........
Solving package specifications: ..........
RemoveError: Remove Error: Error: this 'remove' command cannot be executed because it
would require removing 'conda' dependencies
- 命令:尝试用conda定向下载来源来升级(国内镜像):
C:\Windows\system32>conda update --channel http://pypi.doubanio.com/packages/b8/cb/b919f52dd81b4b2210d0c5529b6b629a4002e08d49a90183605d1181b10c/setuptools-30.2.0-py2.py3-none-any.whl#md5=8749d518ffd7e268037af5178f4f9778 setuptools
不行:
Fetching package metadata .........
CondaHTTPError: HTTP 500 None
for url <None>
An remote server error occurred when trying to retrieve this URL.
A 500-type error (e.g. 500, 501, 502, 503, etc.) indicates the server failed to
fulfill a valid request. The problem may be spurious, and will resolve itself if you
try your request again. If the problem persists, consider notifying the maintainer
of the remote server.
- 命令:考虑用conda升级到指定版本:
C:\Windows\system32>conda upgrade setuptools=30.2.0
依旧不行:
CondaValueError: Value error: version specifications not allowed with 'update'; use
conda update setuptools or
conda install setuptools=30.2.0
- 命令:考虑用conda安装指定版本:
C:\Windows\system32>conda install setuptools=30.2.0
错:
Fetching package metadata .........
Solving package specifications: .
PackageNotFoundError: Package not found: '' Package missing in current win-64 channels:
- setuptools 30.2.0*
You can search for packages on anaconda.org with
anaconda search -t conda setuptools
然后Google各种解决方案
。。。(此处省略若干个网页)
找到这个:
https://github.com/ContinuumIO/anaconda-issues/issues/542
意思就是忽略已经安装的setuptools版本,直接安装最新的版本。
- 命令:
C:\Windows\system32>pip install setuptools --ignore-installed
好了!
Collecting setuptools
Using cached setuptools-30.2.0-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-30.2.0
- 命令:再次安装tensorflow:
C:\Windows\system32>pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
大功告成!
Collecting tensorflow-gpu==0.12.0rc0 from https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
Using cached https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
Requirement already up-to-date: numpy>=1.11.0 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: six>=1.10.0 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: protobuf==3.1.0 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: wheel>=0.26 in d:\program files\anaconda3\lib\site-packages (from tensorflow-gpu==0.12.0rc0)
Requirement already up-to-date: setuptools in d:\program files\anaconda3\lib\site-packages (from protobuf==3.1.0->tensorflow-gpu==0.12.0rc0)
Installing collected packages: tensorflow-gpu
Found existing installation: tensorflow-gpu 0.12.0rc0
Uninstalling tensorflow-gpu-0.12.0rc0:
Successfully uninstalled tensorflow-gpu-0.12.0rc0
Successfully installed tensorflow-gpu-0.12.0rc0
本文介绍了在Windows上安装TensorFlow的过程,包括遇到的依赖问题、解决方法,以及如何升级和安装setuptools,最终成功安装TensorFlow。
2876

被折叠的 条评论
为什么被折叠?



