pip install -r requirements.txt出现错误解决办法

pip install -r requirements.txt安装出现以下错误解决办法如下:

 PS D:\YOLO\yolov5-master> pip install -r requirements.txt
 Collecting matplotlib>=3.2.2
  Downloading matplotlib-3.5.3-cp310-cp310-win_amd64.whl (7.2 MB)
 ━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/7.2 MB 10.2 kB/s eta 0:09:13
ERROR: Exception:
Traceback (most recent call last):
File "D:\Python\lib\site-packages\pip\_vendor\urllib3\response.py", line 435, in _error_catcher
yield
File "D:\Python\lib\site-packages\pip\_vendor\urllib3\response.py", line 516, in read
data = self._fp.read(amt) if not fp_closed else b""
...............
File "D:\Python\lib\site-packages\pip\_vendor\urllib3\response.py", line 440, 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 -r requirements.txt -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

猜你喜欢

转载自blog.csdn.net/Zgy_Csm/article/details/126393618
今日推荐