pip install安装速度慢的问题

**声明:**pip install安装过程慢,解决方案。亲测可用

问题:如下
(pytorch) C:\pytorch>pip install torch-1.2.0-cp36-cp36m-win_amd64.whl
Processing c:\pytorch\torch-1.2.0-cp36-cp36m-win_amd64.whl
Collecting numpy
Downloading numpy-1.19.2-cp36-cp36m-win_amd64.whl (12.9 MB)
|█████████████ | 5.3 MB 6.6 kB/s eta 0:19:04ERROR: Exception:
Traceback (most recent call last):
File “E:\program\Anaconda\envs\pytorch\lib\site-packages\pip_vendor\urllib3\response.py”, line 437, in _error_catcher
yield
File “E:\program\Anaconda\envs\pytorch\lib\site-packages\pip_vendor\urllib3\response.py”, line 519, in read
data = self._fp.read(amt) if not fp_closed else b""

socket.timeout: The read operation timed out
解决方法:
时候只需要在下载的时候选择一下源就能轻松解决这个问题,比如下面的:
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/

但是我的电脑还是出现了些问题:
(pytorch) C:\pytorch>pip install torch-1.2.0-cp36-cp36m-win_amd64.whl -i http://pypi.douban.com/simple
Looking in indexes: http://pypi.douban.com/simple
Processing c:\pytorch\torch-1.2.0-cp36-cp36m-win_amd64.whl
WARNING: The repository located at pypi.douban.com 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 pypi.douban.com’.
ERROR: Could not find a version that satisfies the requirement numpy (from torch1.2.0) (from versions: none)
ERROR: No matching distribution found for numpy (from torch
1.2.0)
解决方法:
(pytorch) C:\pytorch>pip install torch-1.2.0-cp36-cp36m-win_amd64.whl -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

输入pip install torch-1.2.0-cp36-cp36m-win_amd64.whl -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

也就是在后面加上:–trusted-host pypi.douban.com
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_45871695/article/details/109166431