文章:常用的开源镜像站推荐
本文是讲一下通过两种方式来配置让easy_install和pip使用镜像pypi。 以清华大学的TUNA镜像源为例:https://pypi.tuna.tsinghua.edu.cn/simple
1. 命令行安装时临时使用pypi镜像,即:添加 -i https://pypi.tuna.tsinghua.edu.cn/simple 参数即可
# easy_install 命令行 easy_install -i https://pypi.tuna.tsinghua.edu.cn/simple pip # pip install 命令行 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple lxml
2. 设置easy_install和pip的配置文件,永久设置pypi镜像源,命令行就不用-i参数了
easy_install的配置文件 ~/.pydistutils.cfg 在其中添加如下配置:
[easy_install]
index_url = https://pypi.tuna.tsinghua.edu.cn/simple
pip的配置文件 ~/.pip/pip.conf (可能需要创建.pip目录及pip.conf文件),在其中添加如下配置:
pip pypi镜像源配置Shell
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple