基本语法
window:
pip install -i http://mirrors.aliyun.com/pypi/simple/ gevent --trusted-host mirrors.aliyun.com
其中:
pip install gevent #是基础的安装语法。
-i http://mirrors.aliyun.com/pypi/simple/ #是国内镜像网站。
–trusted-host mirrors.aliyun.com #是表示信任镜像网站
国内可以的镜像地址
清华:https://pypi.tuna.tsinghua.edu.cn/simple
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
阿里云:http://mirrors.aliyun.com/pypi/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
永久修改为国内地址的方法
Linux系统:
修改 ~/.pip/pip.conf 中的内容为如下。
(没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
Windows系统:
在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,内容同如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
针对于我目前需要下载库的频率并不高的现状,只用基础语法即可。