温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何将Manjaro、pip、conda更换为国内源

发布时间:2020-11-18 15:00:35 来源:亿速云 阅读:653 作者:Leah 栏目:开发技术

这期内容当中小编将会给大家带来有关如何将Manjaro、pip、conda更换为国内源,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

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更换为国内源了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI