1 下载安装包
可以在官网下载最新版
https://www.anaconda.com/download/success#miniconda
或者在软件目录选择合适的版本
https://repo.anaconda.com/miniconda/
安装包传入离线服务器
./Miniconda3-py311_24.9.2-0-Linux-x86_64.sh
2 运行安装包
./Miniconda3-py311_24.9.2-0-Linux-x86_64.sh
屏幕输出:
Welcome to Miniconda3 py311_24.9.2-0In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
按enter键下一步
显示条款,按q键下一步
输入yes同意条款,按enter键开始安装
Do you accept the license terms? [yes|no]
>>> yes
选择安装位置,按enter键 使用默认的位置:/root/miniconda3
Miniconda3 will now be installed into this location:
/root/miniconda3- Press ENTER to confirm the location- Press CTRL-C to abort the installation- Or specify a different location below[/root/miniconda3] >>>
安装完成,屏幕输出:
Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,run the following command when conda is activated:conda config --set auto_activate_base falseYou can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>>
输入yes,自动更新shell profile。
no change /root/miniconda3/condabin/conda
no change /root/miniconda3/bin/conda
no change /root/miniconda3/bin/conda-env
no change /root/miniconda3/bin/activate
no change /root/miniconda3/bin/deactivate
no change /root/miniconda3/etc/profile.d/conda.sh
no change /root/miniconda3/etc/fish/conf.d/conda.fish
no change /root/miniconda3/shell/condabin/Conda.psm1
no change /root/miniconda3/shell/condabin/conda-hook.ps1
no change /root/miniconda3/lib/python3.11/site-packages/xontrib/conda.xsh
no change /root/miniconda3/etc/profile.d/conda.csh
modified /root/.bashrc==> For changes to take effect, close and re-open your current shell. <==Thank you for installing Miniconda3!
3 查看bashrc
conda已经添加了以下内容
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/root/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; theneval "$__conda_setup"
elseif [ -f "/root/miniconda3/etc/profile.d/conda.sh" ]; then. "/root/miniconda3/etc/profile.d/conda.sh"elseexport PATH="/root/miniconda3/bin:$PATH"fi
fi
unset __conda_setup
# <<< conda initialize <<<
4 验证安装
重启终端或者输入source ~/.bashrc,就可以看到base环境
source ~/.bashrcpython --version
正常输出python版本,安装结束