一、问题
命令执行错误
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重新执行命令