目 录CONTENT

文章目录

pip源修改

xlong
2024-04-29 / 0 评论 / 0 点赞 / 31 阅读 / 1311 字 / 正在检测是否收录...

pip源修改

windows配置

  1. win + R 打开运行窗口,输入 %appdata% 回车

  2. 在打开的文件夹中新建一个pip目录,在pip目录中新建pip.ini文件: 文件内容如下

[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

再次使用pip,即会使用新源。

Linux/Mac配置

Linux/Mac os 环境中,配置文件位置在 ~/.pip/pip.conf(如果不存在创建该目录和文件):

mkdir ~/.pip

打开配置文件 ~/.pip/pip.conf,修改如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

查看 镜像地址:

pip3 config list   

0

评论区