python pip更换(切换)国内镜像源

 国内镜像源列表(个人推荐清华大学的源)

​
清华大学: https://pypi.tuna.tsinghua.edu.cn/simple

阿里云: http://mirrors.aliyun.com/pypi/simple

豆瓣: http://pypi.douban.com/simple

中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple

中国科学技术大学: http://pypi.mirrors.ustc.edu.cn/simple

​

永久更换 

解释说明

 global.index-url:全局软件包链接

 install.trusted-host:安装软件包过程中被信任的主机 

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set install.trusted-host https://pypi.tuna.tsinghua.edu.cn

pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn

 执行完上面两条命令后会在: C:\Users\用户名\AppData\Roaming\pip 路径生成pip.ini配置文件

 查看pip配置

pip config list

临时更换

这里以安装requests为例:

pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple

测试一下 

pip install SomePackage

 

pip清除缓存命令

pip cache purge

 

作者:weixin_41934979

物联沃分享整理
物联沃-IOTWORD物联网 » python pip更换(切换)国内镜像源

发表回复