【保姆级教程:Ubuntu配置深度学习环境(1)Anaconda安装|换源——B站视频同步】

在这里插入图片描述

B站同步视频教程:https://www.bilibili.com/video/BV1JrDqYMEmj/

1. Anaconda下载安装

1.1 下载

conda官网或者清华镜像查找较新版本的conda(国内建议清华源),不用最新是因为可能因为太新而出现各种奇怪的问题,然后复制下载链接,连接服务器后使用wget下载。

# 进入下载目录,用于存放conda安装包
cd Downloads  
# 下载至服务器
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.06-1-Linux-x86_64.sh

若下载时出现bug: HTTP request sent, awaiting response... 403 Forbidden

lk2@lthpc:~/Downloads$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.06-1-Linux-x86_64.sh
--2024-11-07 12:14:56--  https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.06-1-Linux-x86_64.sh
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 2402:f000:1:400::2, 101.6.15.130
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|2402:f000:1:400::2|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2024-11-07 12:14:56 ERROR 403: Forbidden.

解决方法:用 wget --user-agent=“Mozilla” + 要下载的链接

wget --user-agent="Mozilla" https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.06-1-Linux-x86_64.sh

1.2 安装

chmod u+x Anaconda3-2024.06-1-Linux-x86_64.sh
./Anaconda3-2024.06-1-Linux-x86_64.sh

接下来是协议内容,一直按空格到底部,然后输入yes —> 回车

在这里插入图片描述

1.3 验证

重开一个界面,看见左侧出现(base)标志,则成功安装。

在这里插入图片描述

若无,则需手动添加系统环境变量

vim ~/.bashrc
export PATH="/root/anaconda3/bin:$PATH"
source ~/.bashrc
conda init

2. conda换源

2.1 换源为清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
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/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

2.2 查看源

conda config --show-sources

如果要恢复默认源,则使用下述命令,一般用不太到

conda config --remove-key channels

3. pip 换源

一般选用清华源即可,若感觉清华源很慢,则选用备用的中科大源

# 清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 中科大源
pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一只云卷云舒

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值