Solve problems such as Could not find a version that satisfies the requirement cv2 (from versions none) and insufficient permissions during pip installation

1. Problem

Command execution error

pip install opencv-python
pip install cv2  --trusted-host pypi.tuna.tsinghua.edu.cn
pip install cv2  --default-timeout=100 -i https://pypi.tuna.tsinghua.edu.cn/simple

Insert image description here

Insert image description here

Insert image description here
Insert image description here

2. Solve

2.1 Commands

//--trusted-host pypi.tuna.tsinghua.edu.cn 表示信任该站点,忽略警告
//--default-timeout=100 -i https://pypi.tuna.tsinghua.edu.cn/simple 解决no matching distribution found for XXX  
pip install opencv-python --trusted-host pypi.tuna.tsinghua.edu.cn  --default-timeout=100 -i https://pypi.tuna.tsinghua.edu.cn/simple

//如果碰到ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: 'C:\\Python311\\share'Consider using the `--user` option or check the permissions.
//就在命令后面加上参数 --user或者用管理员方式打开cmd重新执行命令

Insert image description here

2.2 install package

Configure to use C drive python311

Insert image description here
Insert image description here

2.3 Solving insufficient permissions

If you encounter ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied. : 'C:\Python311\share'Consider using the --useroption or check the permissions. Just add the parameter --user
after the command or open cmd in administrator mode and re-execute the command
Insert image description here

Guess you like

Origin blog.csdn.net/qyfx123456/article/details/132657766