Manjaro、pip、conda更换国内源的方法

Yolanda ·
更新时间:2024-09-20
· 925 次阅读

Manjaro

切换镜像源。执行以下命令,在稍后的弹窗中选择延迟最低的即可。

sudo pacman-mirrors -i -c China -m rank

设置archlinuxcn源。在/etc/pacman.conf中添加以下命令,中科大源和清华源添加其中一个就可以了:

[archlinuxcn] SigLevel = Optional TrustedOnly #中科大源 Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch #清华源 Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch

更新源列表:

sudo pacman-mirrors -g

更新pacman数据库并更新系统:

sudo pacman -Syyu

更新系统签名:

sudo pacman -S archlinuxcn-keyring sudo pacman -S antergos-keyring

pip

如果只是想临时从指定源下载某个文件,可以在下载命令后加入-i url来指定下载源,其中url是镜像源的地址。例如:

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

永久更换。以添加阿里云的源为例:

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

其中的https://mirrors.aliyun.com/pypi/simple/可以换成其他的镜像源地址。一些常见的源地址如下:

阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

恢复到默认的源。步骤2的命令执行后,配置在~/.pip/pip.conf中。想要换回默认源,只要把文件中相应的部分删掉旧可以了。(实在不行就把文件也删除)

conda

以添加中科大源和清华源为例,以下两个添加一个即可:

中科大源。在终端中执行以下命令:

#USTC仓库镜像 conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ #Conda 附加库 conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/ #使之生效 conda config --set show_channel_urls yes

清华源:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ conda config --set show_channel_urls yes

换回默认源:

conda config --remove-key channels

到此这篇关于Manjaro、pip、conda更换国内源的方法的文章就介绍到这了,更多相关Manjaro、pip、conda更换国内源内容请搜索软件开发网以前的文章或继续浏览下面的相关文章希望大家以后多多支持软件开发网!

您可能感兴趣的文章:Python pip配置国内源的方法window环境pip切换国内源(pip安装异常缓慢的问题)



manjaro 方法 conda pip

需要 登录 后方可回复, 如果你还没有账号请 注册新账号