- 镜像源慢
- cv2
服务器镜像源已经修改过但是pip很慢,因为pip时候使用的不一定是服务器已经配置好的,可以指定镜像源
-i https://pypi.tuna.tsinghua.edu.cn/simple 如: pip install csv -i https://pypi.tuna.tsinghua.edu.cn/simplecv2
cv2是OpenCV2,直接pip会报错
所以 pip install opencv-python
如果在import cv2出现:
Traceback (most recent call last): File "/root/mr/pkl.py", line 10, inimport cv2 File "/root/anaconda3/envs/pyssr/lib/python3.7/site-packages/cv2/__init__.py", line 8, in from .cv2 import * ImportError: libGL.so.1: cannot open shared object file: No such file or directory
可以使用
pip install opencv-python-headless
慢的话指定镜像源:
pip install opencv-python-headless -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-python-headless
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/bf/3e/9dee09e56d42a0c01d7898ceaa6ed4a8fe2763c10d7bded91ef6362e6537/opencv_python_headless-4.5.5.64-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (47.8 MB)
|████████████████████████████████| 47.8 MB 51 kB/s
Requirement already satisfied: numpy>=1.14.5 in ./anaconda3/envs/pyssr/lib/python3.7/site-packages (from opencv-python-headless) (1.21.6)
Installing collected packages: opencv-python-headless
Successfully installed opencv-python-headless-4.5.5.64



