Manjaro Linux、pip与conda配置国内镜像源完整指南

蓝鲸
蓝鲸
发布时间:2026-10-15 | 5人浏览过
原创

本文详细讲解如何在Manjaro Linux系统中切换系统镜像源,以及如何为Python的pip和conda包管理器配置国内镜像。涵盖临时指定源、永久修改配置文件及恢复默认源的操作步骤,提供中科大、清华、阿里云等常用源地址,帮助用户加速软件安装与依赖下载。

Manjaro系统源配置

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镜像源配置

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镜像源配置

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 相关产品和应用

全部下载

专题列表