Python 简介
pip 国内源
由于网络原因,直接使用pip默认源可能会很慢,这里提供一些国内的pip源,你可以选择使用:
阿里云:https://mirrors.aliyun.com/pypi/simple/
中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban):http://pypi.douban.com/simple/
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/
你可以在使用pip时通过-i参数指定使用上述源:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
如果想要永久修改,可以在pip配置文件中设置。配置文件位置和名称取决于操作系统:
Linux/Unix: ~/.pip/pip.conf
macOS: ~/Library/Application Support/pip/pip.conf
Windows: %APPDATA%\pip\pip.ini
配置文件内容如下:
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple
这样配置后,你每次使用pip安装包时都会默认使用这个源。