问题:通过默认镜像安装,下载过程中可能会报错,下载安装失败
Traceback (most recent call last): File “E:\Anaconda3\lib\site-packages\pip_vendor\urllib3\response.py”, line 360, in _error_catcher yield File “E:\Anaconda3\lib\site-packages\pip_vendor\urllib3\response.py”, line 442, in read data = self._fp.read(amt) File “E:\Anaconda3\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 62, in read data = self.__fp.read(amt) File “E:\Anaconda3\lib\http\client.py”, line 447, in read n = self.readinto(b) File “E:\Anaconda3\lib\http\client.py”, line 491, in readinto n = self.fp.readinto(b) File “E:\Anaconda3\lib\socket.py”, line 589, in readinto return self._sock.recv_into(b) File “E:\Anaconda3\lib\ssl.py”, line 1052, in recv_into return self.read(nbytes, buffer) File “E:\Anaconda3\lib\ssl.py”, line 911, in read return 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 “E:\Anaconda3\lib\site-packages\pip_internal\cli\base_command.py”, line 179, in main status = self.run(options, args) File “E:\Anaconda3\lib\site-packages\pip_internal\commands\install.py”, line 315, in run resolver.resolve(requirement_set) File “E:\Anaconda3\lib\site-packages\pip_internal\resolve.py”, line 131, in resolve self._resolve_one(requirement_set, req) File “E:\Anaconda3\lib\site-packages\pip_internal\resolve.py”, line 294, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File “E:\Anaconda3\lib\site-packages\pip_internal\resolve.py”, line 242, in _get_abstract_dist_for self.require_hashes File “E:\Anaconda3\lib\site-packages\pip_internal\operations\prepare.py”, line 334, in prepare_linked_requirement progress_bar=self.progress_bar File “E:\Anaconda3\lib\site-packages\pip_internal\download.py”, line 878, in unpack_url progress_bar=progress_bar File “E:\Anaconda3\lib\site-packages\pip_internal\download.py”, line 702, in unpack_http_url progress_bar) File “E:\Anaconda3\lib\site-packages\pip_internal\download.py”, line 946, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File “E:\Anaconda3\lib\site-packages\pip_internal\download.py”, line 639, in _download_url hashes.check_against_chunks(downloaded_chunks) File “E:\Anaconda3\lib\site-packages\pip_internal\utils\hashes.py”, line 62, in check_against_chunks for chunk in chunks: File “E:\Anaconda3\lib\site-packages\pip_internal\download.py”, line 607, in written_chunks for chunk in chunks: File “E:\Anaconda3\lib\site-packages\pip_internal\utils\ui.py”, line 159, in iter for x in it: File “E:\Anaconda3\lib\site-packages\pip_internal\download.py”, line 596, in resp_read decode_content=False): File “E:\Anaconda3\lib\site-packages\pip_vendor\urllib3\response.py”, line 494, in stream data = self.read(amt=amt, decode_content=decode_content) File “E:\Anaconda3\lib\site-packages\pip_vendor\urllib3\response.py”, line 459, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File “E:\Anaconda3\lib\contextlib.py”, line 130, in exit self.gen.throw(type, value, traceback) File “E:\Anaconda3\lib\site-packages\pip_vendor\urllib3\response.py”, line 365, in _error_catcher raise ReadTimeoutError(self._pool, None, ‘Read timed out.’) pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.
解决方法:一般可以考虑更换镜像源
pip install tensorflow -i https://pypi.douban.com/simple
结果:安装成功,并且速度快
(base) C:\Users\Administrator>pip install tensorflow -i https://pypi.douban.com/simple Looking in indexes: https://pypi.douban.com/simple Collecting tensorflow Downloading https://pypi.doubanio.com/packages/7b/14/e4538c2bc3ae9f4ce6f6ce7ef1180da05abc4a617afba798268232b01d0d/tensorflow-1.13.1-cp37-cp37m-win_amd64.whl (63.1MB) 100% |████████████████████████████████| 63.1MB 207kB/s Collecting keras-preprocessing>=1.0.5 (from tensorflow) Downloading https://pypi.doubanio.com/packages/c0/bf/0315ef6a9fd3fc2346e85b0ff1f5f83ca17073f2c31ac719ab2e4da0d4a3/Keras_Preprocessing-1.0.9-py2.py3-none-any.whl (59kB) 100% |████████████████████████████████| 61kB 4.1MB/s Requirement already satisfied: numpy>=1.13.3 in e:\anaconda3\lib\site-packages (from tensorflow) (1.16.2) Collecting tensorboard<1.14.0,>=1.13.0 (from tensorflow) Downloading https://pypi.doubanio.com/packages/0f/39/bdd75b08a6fba41f098b6cb091b9e8c7a80e1b4d679a581a0ccd17b10373/tensorboard-1.13.1-py3-none-any.whl (3.2MB) 100% |████████████████████████████████| 3.2MB 4.5MB/s Requirement already satisfied: six>=1.10.0 in e:\anaconda3\lib\site-packages (from tensorflow) (1.12.0) Requirement already satisfied: wheel>=0.26 in e:\anaconda3\lib\site-packages (from tensorflow) (0.33.1) Collecting gast>=0.2.0 (from tensorflow) Downloading https://pypi.doubanio.com/packages/4e/35/11749bf99b2d4e3cceb4d55ca22590b0d7c2c62b9de38ac4a4a7f4687421/gast-0.2.2.tar.gz Collecting tensorflow-estimator<1.14.0rc0,>=1.13.0 (from tensorflow) Downloading https://pypi.doubanio.com/packages/bb/48/13f49fc3fa0fdf916aa1419013bb8f2ad09674c275b4046d5ee669a46873/tensorflow_estimator-1.13.0-py2.py3-none-any.whl (367kB) 100% |████████████████████████████████| 368kB 7.3MB/s Collecting termcolor>=1.1.0 (from tensorflow) Downloading https://pypi.doubanio.com/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz Collecting keras-applications>=1.0.6 (from tensorflow) Downloading https://pypi.doubanio.com/packages/90/85/64c82949765cfb246bbdaf5aca2d55f400f792655927a017710a78445def/Keras_Applications-1.0.7-py2.py3-none-any.whl (51kB) 100% |████████████████████████████████| 61kB 3.1MB/s Collecting absl-py>=0.1.6 (from tensorflow) Downloading https://pypi.doubanio.com/packages/da/3f/9b0355080b81b15ba6a9ffcf1f5ea39e307a2778b2f2dc8694724e8abd5b/absl-py-0.7.1.tar.gz (99kB) 100% |████████████████████████████████| 102kB 12.8MB/s Collecting grpcio>=1.8.6 (from tensorflow) Downloading https://pypi.doubanio.com/packages/2a/22/bd327063dd0bdf9d8d640b3185b760707842160e69df909db3fcaab5b758/grpcio-1.20.1-cp37-cp37m-win_amd64.whl (1.6MB) 100% |████████████████████████████████| 1.6MB 6.4MB/s Collecting astor>=0.6.0 (from tensorflow) Downloading https://pypi.doubanio.com/packages/d1/4f/950dfae467b384fc96bc6469de25d832534f6b4441033c39f914efd13418/astor-0.8.0-py2.py3-none-any.whl Collecting protobuf>=3.6.1 (from tensorflow) Downloading https://pypi.doubanio.com/packages/34/ef/f020691889031a8e1d8cb20711daa43cfe999e0768ff6903c4bf70c2eecd/protobuf-3.7.1-cp37-cp37m-win_amd64.whl (986kB) 100% |████████████████████████████████| 993kB 7.9MB/s Requirement already satisfied: werkzeug>=0.11.15 in e:\anaconda3\lib\site-packages (from tensorboard<1.14.0,>=1.13.0->tensorflow) (0.14.1) Collecting markdown>=2.6.8 (from tensorboard<1.14.0,>=1.13.0->tensorflow) Downloading https://pypi.doubanio.com/packages/c0/4e/fd492e91abdc2d2fcb70ef453064d980688762079397f779758e055f6575/Markdown-3.1.1-py2.py3-none-any.whl (87kB) 100% |████████████████████████████████| 92kB 5.1MB/s Collecting mock>=2.0.0 (from tensorflow-estimator<1.14.0rc0,>=1.13.0->tensorflow) Downloading https://pypi.doubanio.com/packages/05/d2/f94e68be6b17f46d2c353564da56e6fb89ef09faeeff3313a046cb810ca9/mock-3.0.5-py2.py3-none-any.whl Requirement already satisfied: h5py in e:\anaconda3\lib\site-packages (from keras-applications>=1.0.6->tensorflow) (2.9.0) Requirement already satisfied: setuptools in e:\anaconda3\lib\site-packages (from protobuf>=3.6.1->tensorflow) (40.8.0) Building wheels for collected packages: gast, termcolor, absl-py Building wheel for gast (setup.py) … done Stored in directory: C:\Users\Administrator\AppData\Local\pip\Cache\wheels\6c\eb\97\547988c386be0acb0797611e9b1a96564e7200bf60be924c80 Building wheel for termcolor (setup.py) … done Stored in directory: C:\Users\Administrator\AppData\Local\pip\Cache\wheels\15\b4\7c\713366bcd4e4f6d38377a66e0742bd15e6920b1939be008dbb Building wheel for absl-py (setup.py) … done Stored in directory: C:\Users\Administrator\AppData\Local\pip\Cache\wheels\85\02\e5\139c27ec57828631565111db6facbddd0eb13bf73e1764e8c0 Successfully built gast termcolor absl-py Installing collected packages: keras-preprocessing, protobuf, markdown, grpcio, absl-py, tensorboard, gast, mock, tensorflow-estimator, termcolor, keras-applications, astor, tensorflow Successfully installed absl-py-0.7.1 astor-0.8.0 gast-0.2.2 grpcio-1.20.1 keras-applications-1.0.7 keras-preprocessing-1.0.9 markdown-3.1.1 mock-3.0.5 protobuf-3.7.1 tensorboard-1.13.1 tensorflow-1.13.1 tensorflow-estimator-1.13.0 termcolor-1.1.0
原文地址:https://www.cnblogs.com/dawankuanmian/p/11526328.html
时间: 2024-10-28 08:06:55