python更改pip源

打开终端或命令提示符,输入以下命令:

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

如果你想恢复默认源,可以输入以下命令:

pip config unset global.index-url

如果你想查看当前的源,可以输入以下命令:

pip config get global.index-url

下面我会详细介绍如何更改pip源。

打开终端或命令提示符,输入以下命令:

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

这个命令会将pip源更改为清华大学的镜像源,下载速度会更快。

如果你想恢复默认源,可以输入以下命令:

pip config unset global.index-url

这个命令会将pip源恢复为官方源。

如果你想查看当前的源,可以输入以下命令:

pip config get global.index-url

这个命令会显示当前的pip源。

如果你想使用其他的镜像源,可以在命令中替换清华大学的镜像源地址为其他镜像源地址。常用的镜像源有:

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

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

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

例如,如果你想使用豆瓣的镜像源,可以输入以下命令:

pip config set global.index-url https://pypi.douban.com/simple/

注意,不同的镜像源可能会有不同的软件包版本和更新速度,选择合适的镜像源可以提高下载速度和软件包的可用性。