对于Python开发用户来讲,PIP安装软件包是家常便饭。但国外的源下载速度实在太慢,并且连接十分不稳定,很容易网络连接超时,一直安装不成功,浪费时间。
所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率。
国内源:
来源地 | 网址 |
---|---|
清华 | https://pypi.tuna.tsinghua.edu.cn/simple |
阿里云 | http://mirrors.aliyun.com/pypi/simple/ |
中国科技大学 | https://pypi.mirrors.ustc.edu.cn/simple/ |
华中理工大学 | http://pypi.hustunique.com/ |
豆瓣 | http://pypi.douban.com/simple/ |
山东理工大学 | http://pypi.sdutlinux.org/ |
使用方法:
以清华的源举例,如果我要安装wordcloud库,在使用pip的时候加参数
-ihttps://pypi.tuna.tsinghua.edu.cn/simple
完整指令:
pip install -ihttps://pypi.tuna.tsinghua.edu.cn/simple wordcloud
这样就会从清华这边的镜像去安装wordcloud库。