pip更改为国内源

1. 查看现有默认pip安装源

pip config list

2. 按次修改

添加指定源

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

3. 固定指定源

创建目录

sudo mkdir ~/.pip

编辑配置文件

sudo nano ~/.pip/pip.conf

添加源,保存退出

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

4. 其他可以指定的源

其他国内镜像源

  • 中国科学技术大学 : https://pypi.mirrors.ustc.edu.cn/simple
  • 豆瓣:http://pypi.douban.com/simple/
  • 阿里云:http://mirrors.aliyun.com/pypi/simple/

顺便记录下conda安装的源配置方法

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --setshow_channel_urls yes

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
扎眼的阳光的头像扎眼的阳光普通用户
上一篇 2023年3月5日 下午10:19
下一篇 2023年3月5日 下午10:20

相关推荐