1、配置与更换镜像源
1.1、为什么要配置镜像源
由于Python在下载包时,容易出现超时等问题,主要是因为Python库的服务器都在国外,国内下载库的速度会很慢,所以需要配置国内镜像源来加快下载速度
1.2、常用国内镜像源
清华:https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣:http://pypi.douban.com/simple
阿里云:http://mirrors.aliyun.com/pypi/simple
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple
华中理工大学:http://pypi.hustunique.com
山东理工大学:http://pypi.sdutlinux.org
1.3、全局镜像源配置
目前国内使用最广泛的是清华的镜像源
全局镜像源配置,在PyCharm终端依次执行如下命令:
pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果不想使用全局镜像源,可以通过如下命令单次使用镜像源下载第三方库:
pip install -i <镜像源地址> <第三方库名>