python 安装tensorflow的问题及解决过程

Microsoft Windows [版本 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:Users oc>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

C:Users oc>pip install tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl
Requirement 'tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl' looks like a filename, but the file does not exist
Processing c:users oc ensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl
Exception:
Traceback (most recent call last):
File "d:python3.5.2installlibsite-packagespipasecommand.py", line 209, in main
status = self.run(options, args)
File "d:python3.5.2installlibsite-packagespipcommandsinstall.py", line 299, in run
requirement_set.prepare_files(finder)
File "d:python3.5.2installlibsite-packagespip eq eq_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "d:python3.5.2installlibsite-packagespip eq eq_set.py", line 577, in _prepare_file
session=self.session, hashes=hashes)
File "d:python3.5.2installlibsite-packagespipdownload.py", line 798, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "d:python3.5.2installlibsite-packagespipdownload.py", line 705, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "d:python3.5.2installlibsite-packagespiputils\__init__.py", line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "d:python3.5.2installlibsite-packagespiputils\__init__.py", line 482, in unzip_file
zipfp = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\noc\tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl'
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:Users oc>python -m pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 16kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Successfully uninstalled pip-8.1.1
Successfully installed pip-9.0.1

C:Users oc>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'tensorflow'
>>>
^C
C:Users oc>pip install D:python3.5.2 ensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl
Processing d:python3.5.2 ensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl
Collecting werkzeug>=0.11.10 (from tensorflow==1.0.0rc2)
Using cached Werkzeug-0.12.2-py2.py3-none-any.whl
Collecting protobuf>=3.2.0 (from tensorflow==1.0.0rc2)
Using cached protobuf-3.4.0-py2.py3-none-any.whl
Collecting six>=1.10.0 (from tensorflow==1.0.0rc2)
Downloading six-1.11.0-py2.py3-none-any.whl
Collecting wheel>=0.26 (from tensorflow==1.0.0rc2)
Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
100% |████████████████████████████████| 51kB 11kB/s
Collecting numpy>=1.11.0 (from tensorflow==1.0.0rc2)
Downloading numpy-1.13.3-cp35-none-win_amd64.whl (13.1MB)
54% |█████████████████▍ | 7.1MB 11kB/s eta 0:08:38Exception:
Traceback (most recent call last):
File "d:python3.5.2installlibsite-packagespip\_vendor equestspackagesurllib3 esponse.py", line 232, in _error_catcher
yield
File "d:python3.5.2installlibsite-packagespip\_vendor equestspackagesurllib3 esponse.py", line 314, in read
data = self._fp.read(amt)
File "d:python3.5.2installlibsite-packagespip\_vendorcachecontrolfilewrapper.py", line 60, in read
data = self.__fp.read(amt)
File "d:python3.5.2installlibhttpclient.py", line 448, in read
n = self.readinto(b)
File "d:python3.5.2installlibhttpclient.py", line 488, in readinto
n = self.fp.readinto(b)
File "d:python3.5.2installlibsocket.py", line 575, in readinto
return self._sock.recv_into(b)
File "d:python3.5.2installlibssl.py", line 929, in recv_into
return self.read(nbytes, buffer)
File "d:python3.5.2installlibssl.py", line 791, in read
return self._sslobj.read(len, buffer)
File "d:python3.5.2installlibssl.py", line 575, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "d:python3.5.2installlibsite-packagespipasecommand.py", line 215, in main
status = self.run(options, args)
File "d:python3.5.2installlibsite-packagespipcommandsinstall.py", line 324, in run
requirement_set.prepare_files(finder)
File "d:python3.5.2installlibsite-packagespip eq eq_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "d:python3.5.2installlibsite-packagespip eq eq_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "d:python3.5.2installlibsite-packagespipdownload.py", line 821, in unpack_url
hashes=hashes
File "d:python3.5.2installlibsite-packagespipdownload.py", line 659, in unpack_http_url
hashes)
File "d:python3.5.2installlibsite-packagespipdownload.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "d:python3.5.2installlibsite-packagespipdownload.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "d:python3.5.2installlibsite-packagespiputilshashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "d:python3.5.2installlibsite-packagespipdownload.py", line 571, in written_chunks
for chunk in chunks:
File "d:python3.5.2installlibsite-packagespiputilsui.py", line 139, in iter
for x in it:
File "d:python3.5.2installlibsite-packagespipdownload.py", line 560, in resp_read
decode_content=False):
File "d:python3.5.2installlibsite-packagespip\_vendor equestspackagesurllib3 esponse.py", line 357, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "d:python3.5.2installlibsite-packagespip\_vendor equestspackagesurllib3 esponse.py", line 324, in read
flush_decoder = True
File "d:python3.5.2installlibcontextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "d:python3.5.2installlibsite-packagespip\_vendor equestspackagesurllib3 esponse.py", line 237, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

C:Users oc>pip --default-timeout=100 install -U Pillow
Collecting Pillow
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000004023A1F9B0>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。',)': /simple/pillow/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000004023A1F3C8>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。',)': /simple/pillow/
Downloading Pillow-4.3.0-cp35-cp35m-win_amd64.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 10kB/s
Collecting olefile (from Pillow)
Downloading olefile-0.44.zip (74kB)
100% |████████████████████████████████| 81kB 10.0kB/s
Installing collected packages: olefile, Pillow
Running setup.py install for olefile ... done
Successfully installed Pillow-4.3.0 olefile-0.44


C:Users oc>pip install D:python3.5.2 ensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl
Processing d:python3.5.2 ensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl
Collecting wheel>=0.26 (from tensorflow==1.0.0rc2)
Using cached wheel-0.30.0-py2.py3-none-any.whl
Collecting numpy>=1.11.0 (from tensorflow==1.0.0rc2)
Downloading numpy-1.13.3-cp35-none-win_amd64.whl (13.1MB)
100% |████████████████████████████████| 13.1MB 27kB/s
Collecting werkzeug>=0.11.10 (from tensorflow==1.0.0rc2)
Using cached Werkzeug-0.12.2-py2.py3-none-any.whl
Collecting protobuf>=3.2.0 (from tensorflow==1.0.0rc2)
Using cached protobuf-3.4.0-py2.py3-none-any.whl
Collecting six>=1.10.0 (from tensorflow==1.0.0rc2)
Using cached six-1.11.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in d:python3.5.2installlibsite-packages (from protobuf>=3.2.0->tensorflow==1.0.0rc2)
Installing collected packages: wheel, numpy, werkzeug, six, protobuf, tensorflow
Successfully installed numpy-1.13.3 protobuf-3.4.0 six-1.11.0 tensorflow-1.0.0rc2 werkzeug-0.12.2 wheel-0.30.0

C:Users oc>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> tensorflow._version_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute '_version_'
>>> tensorflow.__version__
'1.0.0-rc2'
>>>

原文地址:https://www.cnblogs.com/LJW-XJTU/p/7768547.html