在Anaconda中使用pip install 下载想要的软件包。提示时间超时、SSL版本出现问题。当解决版本问题之后,使用pip install package 时,出现找不到软件。
原因为进入国外的网站,,撞墙了!!!!!
首先,解决ssl版本问题:
pip install --trusted-host pypi.python.org pythonPackageName
该方法没有解决根本原因,只是越过ssl 版本进行下载。
pip 加速方法:
jdmdx@jdmdx-All-Series:~$ mkdir .pip/pip.config
vim pip.config
在里面填写:
[global]
timeout = 60
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
保存。
pip 更换至国内源:
目前国内的镜像源有很多,比较流行的有豆瓣、阿里、清华镜像。
豆瓣:http://pypi.douban.com/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里:https://opsx.alibaba.com/mirror
目前我经常使用的为清华镜像。临时使用的方法为:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple package
用-i 进行指定。
长久使用的方法:
更改pip加速的配置,如上所示:
将index-url对应的网址改为清华镜像的网址进行改进。
#########################
eg:在anaconda中下载matplotlib软件的命令为:
pip install --index-url=https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.python.org matplotlib
注:对于ssl版本问题,这里只有临时的方法。永久改动,试过很多博客介绍的方法,都不好用。。。
很多方法出现了鸡生蛋、蛋生鸡的问题!!