下载安装文件
清华大学开源软件镜像站:下载地址
准备安装文件
在网页中找到对应的安装文件,如Anaconda3-2022.05-Linux-x86_64.sh
移动安装文件到用户根目录下
开始安装Anaconda3
安装脚本
SHELLFILE=Anaconda3-2022.05-Linux-x86_64.sh
sudo chmod +x ~/${SHELLFILE} && ~/${SHELLFILE}
# 稍后会出现很多提示信息,可以长按空格键直接跳过
安装选项
下面的安装选项中,省略号代表程序输出的无关信息,可忽略
Do you accept the license terms? [yes|no]
[no] >>> yes
..................................................
[/home/ai-machine/anaconda3] >>> Anaconda3
..................................................
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> no
环境变量
在用户根目录下,找到.bashrc文件并打开,在最后添加下面三行文本,保存并退出
# added by Anaconda3 2022.05 installer
export PATH="$HOME/Anaconda3/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/Anaconda3/lib:$LD_LIBRARY_PATH"
环境优化
# 针对conda的下载,在控制台运行以下命令添加下载通道即可
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
# 针对pip的下载,把安装命令修改为以下样例即可,例如:
pip install ${PACKAGE_NAME} -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
运行测试
如果能显示以下信息,则表明安装成功
Python 3.9.12 (main, Apr 5 2022, 06:56:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>