Windows10系统用pip3安装Tensorflow指定版本(之前安装的2.1.0版本太高了):
(tensorflow) C:\Users\XXX>pip3 install tensorflow==1.2.1
出错:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='', port=443): Read timed out. (read timeout=15)",)': /simple/tensorflow/Collecting tensorflow==1.2.1Downloading tensorflow-1.2.1-cp35-cp35m-win_amd64.whl (21.2 MB)|█ | 665 kB 6.1 kB/s eta 0:55:57ERROR: Exception:Traceback (most recent call last):File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcheryieldFile "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in readdata = self._fp.read(amt) if not fp_closed else b""File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in readdata = self.__fp.read(amt)File "c:\programdata\anaconda3\envs\tensorflow\lib\http\client.py", line 448, in readn = self.readinto(b)File "c:\programdata\anaconda3\envs\tensorflow\lib\http\client.py", line 488, in readinton = self.fp.readinto(b)File "c:\programdata\anaconda3\envs\tensorflow\lib\socket.py", line 576, in readintoreturn self._sock.recv_into(b)File "c:\programdata\anaconda3\envs\tensorflow\lib\ssl.py", line 937, in recv_intoreturn self.read(nbytes, buffer)File "c:\programdata\anaconda3\envs\tensorflow\lib\ssl.py", line 799, in readreturn self._sslobj.read(len, buffer)File "c:\programdata\anaconda3\envs\tensorflow\lib\ssl.py", line 583, in readv = self._sslobj.read(len, buffer)socket.timeout: The read operation timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _mainstatus = self.run(options, args)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\commands\install.py", line 331, in runresolver.resolve(requirement_set)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\legacy_resolve.py", line 177, in resolvediscovered_reqs.extend(self._resolve_one(requirement_set, req))File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\legacy_resolve.py", line 333, in _resolve_oneabstract_dist = self._get_abstract_dist_for(req_to_install)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\legacy_resolve.py", line 282, in _get_abstract_dist_forabstract_dist = self.preparer.prepare_linked_requirement(req)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 482, in prepare_linked_requirementhashes=hashes,File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 287, in unpack_urlhashes=hashes,File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 159, in unpack_http_urllink, downloader, temp_dir.path, hashesFile "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 303, in _download_http_urlfor chunk in download.chunks:File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\utils\ui.py", line 160, in iterfor x in it:File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\network\utils.py", line 39, in response_chunksdecode_content=False,File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 564, in streamdata = self.read(amt=amt, decode_content=decode_content)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 529, in readraise IncompleteRead(self._fp_bytes_read, self.length_remaining)File "c:\programdata\anaconda3\envs\tensorflow\lib\contextlib.py", line 77, in __exit__self.gen.throw(type, value, traceback)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 430, in _error_catcherraise ReadTimeoutError(self._pool, None, "Read timed out.")pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='', port=443): Read timed out.
参考链接:
/qq_43211132/article/details/94426458
/Yumi_huang/article/details/79529361
使用豆瓣镜像安装:
pip install tensorflow==1.2.1 -i /simple
Looking in indexes: /simpleWARNING: The repository located at is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host '.ERROR: Could not find a version that satisfies the requirement tensorflow==1.2.1 (from versions: none)ERROR: No matching distribution found for tensorflow==1.2.1
直接按照提示加上--trusted-host:
pip3 install tensorflow==1.2.1 -i --trusted-host /simple
Looking in indexes: --trusted-hostCollecting /simpleDownloading /simple (11.2 MB)|████████████████████████████████| 11.2 MB 3.3 MB/sERROR: Cannot unpack file C:\Users\Mandy\AppData\Local\Temp\pip-unpack-s4p2xhui\simple (downloaded from C:\Users\Mandy\AppData\Local\Temp\pip-req-build-iu9diins, content-type: text/html; charset=utf-8); cannot detect archive formatERROR: Cannot determine archive format of C:\Users\Mandy\AppData\Local\Temp\pip-req-build-iu9diins
--------------------------------------------------------------------------------------------------------------------------------------------------------
【补充】
类似的错误:
Looking in indexes: /pypi/simple/WARNING: The repository located at is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host '.ERROR: Could not find a version that satisfies the requirement tqdm (from versions: none)ERROR: No matching distribution found for tqdmWARNING: The repository located at is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host '.
若镜像源中是http,则可以尝试按照提示直接把http改为https:
pip install tqdm -i /pypi/simple/
--------------------------------------------------------------------------------------------------------------------------------------------------------
需要把-i去掉:
pip3 install tensorflow==1.2.1 --trusted-host /simple
运行一段时间,还是会报一开始的一大堆错误:
Collecting tensorflow==1.2.1Downloading tensorflow-1.2.1-cp35-cp35m-win_amd64.whl (21.2 MB)|███████████████ | 9.8 MB 6.5 kB/s eta 0:29:20ERROR: Exception:Traceback (most recent call last):File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcheryieldFile "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in readdata = self._fp.read(amt) if not fp_closed else b""File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in readdata = self.__fp.read(amt)File "c:\programdata\anaconda3\envs\tensorflow\lib\http\client.py", line 448, in readn = self.readinto(b)File "c:\programdata\anaconda3\envs\tensorflow\lib\http\client.py", line 488, in readinton = self.fp.readinto(b)File "c:\programdata\anaconda3\envs\tensorflow\lib\socket.py", line 576, in readintoreturn self._sock.recv_into(b)File "c:\programdata\anaconda3\envs\tensorflow\lib\ssl.py", line 937, in recv_intoreturn self.read(nbytes, buffer)File "c:\programdata\anaconda3\envs\tensorflow\lib\ssl.py", line 799, in readreturn self._sslobj.read(len, buffer)File "c:\programdata\anaconda3\envs\tensorflow\lib\ssl.py", line 583, in readv = self._sslobj.read(len, buffer)socket.timeout: The read operation timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\cli\base_command.py", line 186, in _mainstatus = self.run(options, args)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\commands\install.py", line 331, in runresolver.resolve(requirement_set)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\legacy_resolve.py", line 177, in resolvediscovered_reqs.extend(self._resolve_one(requirement_set, req))File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\legacy_resolve.py", line 333, in _resolve_oneabstract_dist = self._get_abstract_dist_for(req_to_install)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\legacy_resolve.py", line 282, in _get_abstract_dist_forabstract_dist = self.preparer.prepare_linked_requirement(req)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 482, in prepare_linked_requirementhashes=hashes,File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 287, in unpack_urlhashes=hashes,File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 159, in unpack_http_urllink, downloader, temp_dir.path, hashesFile "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\operations\prepare.py", line 303, in _download_http_urlfor chunk in download.chunks:File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\utils\ui.py", line 160, in iterfor x in it:File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_internal\network\utils.py", line 39, in response_chunksdecode_content=False,File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 564, in streamdata = self.read(amt=amt, decode_content=decode_content)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 529, in readraise IncompleteRead(self._fp_bytes_read, self.length_remaining)File "c:\programdata\anaconda3\envs\tensorflow\lib\contextlib.py", line 77, in __exit__self.gen.throw(type, value, traceback)File "c:\programdata\anaconda3\envs\tensorflow\lib\site-packages\pip\_vendor\urllib3\response.py", line 430, in _error_catcherraise ReadTimeoutError(self._pool, None, "Read timed out.")pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='', port=443): Read timed out.
感觉是网络的问题,打算换镜像源(参考链接:/microman/p/6107879.html)一个一个试:
清华:https://pypi.tuna./simple(第一个试就成功了):
pip3 install --upgrade tensorflow==1.2.1 -i https://pypi.tuna./simpleLooking in indexes: https://pypi.tuna./simpleCollecting tensorflow==1.2.1Downloading https://pypi.tuna./packages/a5/7a/c3250d3c065032f0a0cf2b6c777913a69c075635512e9283cbf1f83684ae/tensorflow-1.2.1-cp35-cp35m-win_amd64.whl (21.2 MB)|████████████████████████████████| 21.2 MB 97 kB/sRequirement already satisfied, skipping upgrade: wheel>=0.26 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (0.30.0)Requirement already satisfied, skipping upgrade: bleach==1.5.0 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (1.5.0)Requirement already satisfied, skipping upgrade: werkzeug>=0.11.10 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (0.14.1)Requirement already satisfied, skipping upgrade: numpy>=1.11.0 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (1.18.1)Requirement already satisfied, skipping upgrade: markdown>=2.6.8 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (2.6.11)Requirement already satisfied, skipping upgrade: protobuf>=3.2.0 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (3.11.3)Requirement already satisfied, skipping upgrade: html5lib==0.9999999 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (0.9999999)Collecting backports.weakref==1.0rc1Downloading https://pypi.tuna./packages/6a/f7/ae34b6818b603e264f26fe7db2bd07850ce331ce2fde74b266d61f4a2d87/backports.weakref-1.0rc1-py3-none-any.whl (4.3 kB)Requirement already satisfied, skipping upgrade: six>=1.10.0 in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from tensorflow==1.2.1) (1.14.0)Requirement already satisfied, skipping upgrade: setuptools in c:\programdata\anaconda3\envs\tensorflow\lib\site-packages (from protobuf>=3.2.0->tensorflow==1.2.1) (45.2.0)Installing collected packages: backports.weakref, tensorflowAttempting uninstall: tensorflowFound existing installation: tensorflow 2.1.0Uninstalling tensorflow-2.1.0:Successfully uninstalled tensorflow-2.1.0Successfully installed backports.weakref-1.0rc1 tensorflow-1.2.1
其它镜像:
阿里云:/pypi/simple/
中国科技大学 https://pypi.mirrors./simple/
华中理工大学:/
山东理工大学:/
豆瓣:/simple/(之前试过不行)
如果还是不行可以放弃pip,尝试下载.whl文件离线安装。