安装python扩展 && 查看扩展
python install model_name #安装名为model_name的扩展
python -m pip list #查看已安装得扩展
安装opencv-python超时
错误信息
C:\Windows\system32>pip install opencv-python
Collecting opencv-python
Downloading opencv_python-4.5.5.62-cp36-abi3-win_amd64.whl (35.4 MB)
------------------ --------------------- 16.7/35.4 MB 19.1 kB/s eta 0:16:18
ERROR: Exception:
Traceback (most recent call last):
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\urllib3\response.py”, line 438, in _error_catcher
yield
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\urllib3\response.py”, line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 90, in read
data = self.__fp.read(amt)
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\http\client.py”, line 465, in read
s = self.fp.read(amt)
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\socket.py”, line 705, in readinto
return self._sock.recv_into(b)
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\ssl.py”, line 1273, in recv_into
return self.read(nbytes, buffer)
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\ssl.py”, line 1129, in read
return self._sslobj.read(len, buffer)
TimeoutError: The read operation timed out
During handling of the above exception, another exception occurred:
…
exit
self.gen.throw(typ, value, traceback)
File “C:\Users\wangx\AppData\Local\Programs\Python\Python310\lib\site-packages\pip_vendor\urllib3\response.py”, line 443, 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 --default-timeout=1000 model_name
C:\Windows\system32>pip install --default-timeout=1000 opencv-python
Collecting opencv-python
Downloading opencv_python-4.5.5.62-cp36-abi3-win_amd64.whl (35.4 MB)
---------------------------------------- 35.4/35.4 MB 78.2 kB/s eta 0:00:00
Requirement already satisfied: numpy>=1.14.5 in c:\users\wangx\appdata\local\programs\python\python310\lib\site-packages (from opencv-python) (1.22.2)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.5.5.62