python pip更换(切换)国内镜像源
执行完上面两条命令后会在: C:\Users\用户名\AppData\Roaming\pip 路径生成pip.ini配置文件。install.trusted-host:安装软件包过程中被信任的主机。global.index-url:全局软件包链接。
·
国内镜像源列表(个人推荐清华大学的源)
清华大学: https://pypi.tuna.tsinghua.edu.cn/simple
阿里云: https://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
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)