新到的电脑,由于电脑不让连网。只能先下载好各种包进行离线安装。先尝试的是安装cpu版本的。有时间下载好各种GPU用的包再装GPU版本的TensorFlow。遇到各种障碍,这是在自己电脑上遇到的问题,所以仅供参考。采用的是pip安装方法。
电脑配置:
处理器 Intel(R) Xeon(R) CPU E5-2609 v4 @ 1.70GHz
内存容量 16.0GB
显卡 NVIDIA GeForce GTX 1080 Ti
硬盘 ST1000DM003-1SB102 (1.0TB)
主板 102F
网卡 1、Intel(R) Ethernet Connection (2) I218-LM
2、802.11n USB Wireless LAN Card
声卡 1、NVIDIA High Definition Audio
2、Realtek High Definition Audio
显示器 P27 分辨率:3840x2160
当前操作系统 Windows 10 64位
先安装上python3.5.2。
本来是自定义安装到D盘的,后来无缘无故各种坑。后来又重新按默认安装c盘的。
1.由于python3.5.2版本中自带的pip 8.1.1较低无法安装各种whl文件,所以就先升级了pip。我把所有文件全放在桌面home文件夹了。用的cd命令安装的。
打开cmd,cd到桌面文件夹home,一开始也是自己百度cd命令的,我这里的命令仅供参考,具体要根据自己文件放在电脑什么位置。即C:\Users\球权>cd desktop/home。然后:
C:\Users\球权\Desktop\home>pip install pip-9.0.1-py2.py3-none-any.whl
Processing c:\users\球权\desktop\home\pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Successfully uninstalled pip-8.1.1
2.然后,安装numpy。
C:\Users\球权\Desktop\home>pip install numpy-1.13.3-cp35-none-win_amd64.whl
Processing c:\users\球权\desktop\home\numpy-1.13.3-cp35-none-win_amd64.whl
Installing collected packages: numpy
Successfully installed numpy-1.13.3
3.安装pillow,目前,尝试着安装各种说是3.5的pillow,但尝试了很多最后只有这个版本
Pillow-3.4.2-cp35-cp35m-win_amd64.whl能安装在python3.5.2上。
C:\Users\球权\Desktop\home>pip install Pillow-3.4.2-cp35-cp35m-win_amd64.whl
Processing c:\users\球权\desktop\home\pillow-3.4.2-cp35-cp35m-win_amd64.whl
Installing collected packages: Pillow
Successfully installed Pillow-3.4.2
如果需要其他的功能包,如:自己在百度下载吧。
其中常用到的Python包有:
* numpy是使用Python进行科学计算的基础包。
* matplotlib是Python中著名的绘图库。
* h5py在Python提供读取HDF5二进制数据格式文件的接口,本次的训练及测试图片集是以HDF5储存的。
* PIL(Python Image Library)为Python提供图像处理功能。
* scipy基于NumPy来做高等数学、信号处理、优化、统计和许多其它科学任务的拓展库。
* sklearn提供了数种聚类算法,为数据挖掘和数据分析提供了简单有效的工具。
4.安装TensorFlow(cpu)
出现了一些问题,如下:
C:\Users\球权\Desktop\home>pip install tensorflow-1.1.0rc2-cp35-cp35m-win_amd64.whl
Processing c:\users\球权\desktop\home\tensorflow-1.1.0rc2-cp35-cp35m-win_amd64.whl
Collecting wheel>=0.26 (from tensorflow==1.1.0rc2)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001A456667748>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/wheel/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001A456671A20>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/wheel/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001A456671438>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/wheel/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001A456671EF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/wheel/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000001A456671F98>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)': /simple/wheel/
Could not find a version that satisfies the requirement wheel>=0.26 (from tensorflow==1.1.0rc2) (from versions: )
No matching distribution found for wheel>=0.26 (from tensorflow==1.1.0rc2)
这就出现问题了。就是没有满足条件的wheel文件。
从最后安装成功发现win10 64位安装TensorFlow可能需要满足的条件是(标红的地方):
C:\Users\球权\Desktop\home>pip install tensorflow-1.1.0rc2-cp35-cp35m-win_amd64.whl
Processing c:\users\球权\desktop\home\tensorflow-1.1.0rc2-cp35-cp35m-win_amd64.whl
Requirement already satisfied: wheel>=0.26 in c:\users\球权\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==1.1.0rc2)
Requirement already satisfied: protobuf>=3.2.0 in c:\users\球权\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==1.1.0rc2)
Requirement already satisfied: numpy>=1.11.0 in c:\users\球权\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==1.1.0rc2)
Requirement already satisfied: six>=1.10.0 in c:\users\球权\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==1.1.0rc2)
Requirement already satisfied: werkzeug>=0.11.10 in c:\users\球权\appdata\local\programs\python\python35\lib\site-packages (from tensorflow==1.1.0rc2)
Requirement already satisfied: setuptools in c:\users\球权\appdata\local\programs\python\python35\lib\site-packages (from protobuf>=3.2.0->tensorflow==1.1.0rc2)
Installing collected packages: tensorflow
Successfully installed tensorflow-1.1.0rc2
所以如果发现版本不满足条件,就找相应较高的版本安装上就行了。测试的安装是否成功的话.就相应百度测试的简单代码就行了。
如:
>>>import tensorflowas tf
>>>hello = tf.constant('Hello, TensorFlow!')
>>>sess = tf.Session()
>>>print(sess.run(hello))Hello, TensorFlow!
>>>a = tf.constant(10)
>>>b = tf.constant(32)
>>>print(sess.run(a + b))
42
5.最后装pycharm的话就不多说了。
最后我安装成功所需要的包,除了pycharm没有,其他应该全有了,如果缺什么的话在这个链接
里搜吧https://pypi.python.org/pypi。
所需要的whl文件包链接:http://download.csdn.net/download/qq_31008189/10136221。
这是我自己整理上传的资源,本来找免资源分上传的,但好像没有免资源分的,最低2分。
第一次写文章,有什么不对,请见谅。