如何在Python中更换国内镜像源

1.永久修改镜像源

python的命令提示符中运行以下语句,该条语句将pip的下载源永久更改为某个镜像站,这里以清华大学开源镜像站为例:

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

2.临时修改镜像源

在安装库的时候,临时需要用到某个镜像,这里以清华大学镜像为例下载pandas库

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

3.pip下载源常用的国内镜像

豆瓣:http://pypi.douban.com/simple/
阿里云:http://mirrors.aliyun.com/pypi/simple/
华为云:https://repo.huaweicloud.com/repository/pypi/simple
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple
中科大:https://pypi.mirrors.ustc.edu.cn/simple/
物联沃分享整理
物联沃-IOTWORD物联网 » 如何在Python中更换国内镜像源

发表评论