解决pip安装中Could not find a version that satisfies the requirement cv2 (from versions none)和权限不足等问题

一、问题

命令执行错误

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

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

二、解决

2.1 命令

//--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重新执行命令

在这里插入图片描述

2.2 install package

配置使用C盘python311

在这里插入图片描述
在这里插入图片描述

2.3 解决权限不足

如果碰到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重新执行命令
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qyfx123456/article/details/132657766