本文详细阐述了在 Ubuntu 系统中安装 Anaconda3 的完整流程。包括 Anaconda3 安装包的获取途径,具体安装过程中的每一个步骤及注意事项,还有安装后的环境变量设置和安装成功的验证方法。旨在为 Ubuntu 用户提供清晰、易懂且准确的 Anaconda3 安装指南,帮助读者顺利完成安装,为后续的 Python 开发和数据处理工作奠定基础。
1. 下载Anaconda
下载地址:
Anaconda | Anaconda Distribution
下载适合电脑Python版本和计算平台的版本。
2. 推荐切换到国内源
anaconda的源改为国内镜像, 配置文件是~/.condarc
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
pip源改为国内镜像, 配置文件是~/.pip/pip.conf, 该后的文件内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host=https://pypi.tuna.tsinghua.edu.cn
update conda
conda update conda -y
conda update anaconda -y
conda update python -y
conda update --all -y
3. 安装 Anaconda
bash Anaconda3-5.3.0-Linux-x86_64.sh # make sure append the Anaconda executable
一直按回车
遇到下面的提示,按回车会安装到默认目录;
如果系统安装盘不够大,建议安装在其它挂载盘上,这里输入你想要安装的目录,然后按回车。
Anaconda3 will now be installed into this location:
/home/xxx/anaconda3- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
遇到下面的信息表示安装成功
no change /home/xueht/disk/anaconda3/condabin/conda
no change /home/xueht/disk/anaconda3/bin/conda
no change /home/xueht/disk/anaconda3/bin/conda-env
no change /home/xueht/disk/anaconda3/bin/activate
no change /home/xueht/disk/anaconda3/bin/deactivate
no change /home/xueht/disk/anaconda3/etc/profile.d/conda.sh
no change /home/xueht/disk/anaconda3/etc/fish/conf.d/conda.fish
no change /home/xueht/disk/anaconda3/shell/condabin/Conda.psm1
no change /home/xueht/disk/anaconda3/shell/condabin/conda-hook.ps1
no change /home/xueht/disk/anaconda3/lib/python3.12/site-packages/xontrib/conda.xsh
no change /home/xueht/disk/anaconda3/etc/profile.d/conda.csh
modified /home/xueht/.zshrc==> For changes to take effect, close and re-open your current shell. <==Thank you for installing Anaconda3!
启动
directory to your PATH environment variable in .bashrc
source ~/.bashrc
python --version # to show the python version
参考文献
https://www.pugetsystems.com/labs/hpc/Install-TensorFlow-with-GPU-Support-the-Easy-Way-on-Ubuntu-18-04-without-installing-CUDA-1170/
Ubuntu18.04 + NVidia显卡 + Anaconda3 + Tensorflow-GPU 安装、配置、测试 (无需手动安装CUDA) - xbit - 博客园