一、去官网下载Anaconda,我下载的是Anaconda3
二、安装Anaconda3
1、下载完成后命令行进入 Anaconda3-5.3.1-Linux-x86_64.sh 所在的路径:
vision@vision-PC:~/Downloads$ bash Anaconda3-5.3.1-Linux-x86_64.sh
Welcome to Anaconda3 5.3.1
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
然后根据提示,按回车确认。
它会提示你是否接受协议,这里直接输入yes,再按回车即可(不要直接按回车,这样默认是no)
Do you accept the license terms? [yes|no]
[no] >>> yes
接下来会提示你指定安装路径,这里可以使用默认的,也可以自己指定,最好自己指定文件路径,方便以后维护
Anaconda3 will now be installed into this location:
/home/vision/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/vision/anaconda3] >>> /home/vision/Softwares/Anaconda3
然后就是等待安装进程完成,完成后会提示你是否要将Anaconda的安装路径添加到PATH环境变量中,必须输入yes(不要直接按回车,这样默认是no),否则需要自己设置环境变量。
installation finished.
Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /home/hj/.bashrc ? [yes|no]
[no] >>> yes
配置后的环境遍历如下:
# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/vision/Softwares/Anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/home/vision/Softwares/Anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/vision/Softwares/Anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/home/vision/Softwares/Anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
之后就是等待安装完成,Anaconda3 安装完成提示是否安装VSCode,这里选择yes。如下:
For this change to become active, you have to open a new terminal.
Thank you for installing Anaconda3!
===========================================================================
Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined
code editor with support for development operations like debugging, task
running and version control.
To install Visual Studio Code, you will need:
- Administrator Privileges
- Internet connectivity
Visual Studio Code License: https://code.visualstudio.com/license
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>>
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
>>> yes
Proceeding with installation of Microsoft VSCode
VSCode is already installed!
三、验证Anaconda3是否安装成功
重新打开一个终端,输入pyhton
vision@vision-PC:~$ python
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
如上图所示, python环境已经自动由Anaconda进行托管
四、Anaconda3的卸载
1、删除整个anaconda目录:
由于Anaconda的安装文件都包含在一个目录中,所以直接将该目录删除即可。到包含整个anaconda目录的文件夹下,删除整个Anaconda目录:
rm -rf Anaconda3安装路径
2、清理下.bashrc中的Anaconda路径:
打开终端并输入:
sudo gedit ~/.bashrc
在.bashrc文件末尾,删除掉Anaconda3写入的东西
# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/home/vision/Softwares/Anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/home/vision/Softwares/Anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/vision/Softwares/Anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/home/vision/Softwares/Anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
保存并关闭文件
3.使其立即生效,在终端执行:
source ~/.bashrc
4.关闭终端,然后再重启一个新的终端,这一步很重要,不然在原终端上还是绑定有Anaconda3.