1.先下载安装脚本
bash
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
2.开始安装
bash
bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3
-b: 以批处理模式安装,无需交互
-p:安装目录(不用提前创建)
3.添加环境变量
3.1针对用户
bash
echo 'export PATH="/opt/miniconda3/bin:$PATH"' >> ~/.bashrc
3.2针对所有用户
bash
echo 'export PATH="/opt/miniconda3/bin:$PATH"' >> /etc/profile
4.检查安装
bash
# 命令
conda --version
# 结果
conda 23.9.0
5.初始化
bash
source ~/.bashrc # 单个用户
source /etc/profile # 全局用户
conda init bash # 初始化
conda activate base # 激活base环境
conda create -n common python=3.10 # 创建一个名为common的python版本为3.10的环境