下载Anaconda3
- 到官网找到适合自己版本的文件
链接: Anaconda下载页面 - 复制要下载的文件名称
- 在Linux终端输入
wget https://repo.anaconda.com/archive/文件名称
例如:wget https://repo.anaconda.com/archive/Anaconda3-2021.04-Linux-x86_64.sh
会下载文件到当前目录
安装Anaconda3
- 先给文件赋权
chmod +x Anaconda3-2021.04-Linux-x86_64.sh
- 安装
./Anaconda3-2021.04-Linux-x86_64.sh
需要回车的时候回车即可
看到more以后一直回车会下拉,直到出现yes|no,输入yes
出现MORE,一直回车,直到出现“Anaconda3 will now be installed into this location:”这行字,直接回车
出现下面的图片后
输入yes,是为了直接添加Anaconda到环境变量,如果添加成功,可以直接到第四步验证
添加环境变量
source ~/.bashrc
检测是否安装成功
anaconda -V
conda -V
问题:anaconda: command not found
解决:
vim ~/.bashrc
在文件末尾添加:export PATH=~/anaconda3/bin:$PATH
保存退出
source ~/.bashrc
即可解决
问题2:
安装好 anaconda 之后新建虚拟环境之后激活环境报错
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
-----------------------------------
Anaconda error:CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell
Windows:conda init <SHELL_NAME>
SHELL_NAME 替换成当前的shell名称,比如 Windows 一般是 conda init cmd
Linux:source activate