Ubuntu中anaconda安装opencv-python,pip 清华源,避免超时方法

Ubuntu中anaconda安装opencv-python,pip 清华源,避免超时方法,解决

解决外网下载速度慢超时问题,以及清华源安装失败问题

Pip安装

pip install opencv-python
// 如果这一步提示缺少pip,请自行安装,如显示超时报错请采用以下方法:
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
// 这样操作也可能会安装失败,不要紧,我们找到这句话后面显示的如下内容
Collecting opencv-python
Downloading https://files.pythonhosted.org/packages/a3/50/04d0669afe884f137c2f490642756e8c4a658254300a9eaf253d1e643085/opencv_python-4.1.0.25-cp37-cp37m-win_amd64.whl (37.3MB)
//将Downloading后面的网址复制到浏览器中打开,自行下载,然后本地离线安装即可:
pip install opencv_python-4.1.0.25-cp37-cp37m-win_amd64.whl
//稍等即可安装完成

验证安装是否成功

//执行pip出现以下内容即成功
(base) zhangxue@zhangxue-N9x0TC:~$ pip install opencv-python
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: opencv-python in ./anaconda3/lib/python3.7/site-packages (4.2.0.32)
Requirement already satisfied: numpy>=1.14.5 in ./anaconda3/lib/python3.7/site-packages (from opencv-python) (1.17.2)
#或者在python中import cv2不报错说明安装成功
(base) zhangxue@zhangxue-N9x0TC:~$ python
Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> 

总结

部分同学尝试pip末尾添加–default-timeout=1000也能安装成功,但是本人尝试失败

pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=1000

接下来需要配置pycharm环境

相关推荐
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页