简介
Anaconda(官方网站)就是可以便捷获取包且对包能够进行管理,同时对环境可以统一管理的发行版本。Anaconda包含了conda、Python在内的超过180个科学包及其依赖项。
1、下载并安装Anaconda
下载
参看最新地址: https://www.anaconda.com/products/individual 中的linux版本
cd /usr/local/
# 下载包
wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
安装
sh Anaconda3-2021.11-Linux-x86_64.sh
安装过程需要同意协议,全部按回车到协议底部,然后输入yes同意
Do you accept the license terms? [yes|no]
[no] >>>
Please answer 'yes' or 'no':
>>> yes
安装目录的选择,默认安装到/root/anaconda3,直接回车即可,如需更改自行Google
Anaconda3 will now be installed into this location:
/root/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/anaconda3] >>>
询问是否需要初始化conda,建议选择no。若选择yes,是在/root/.bashrc目录中自动添加环境变量,会使得开机自动启动base环境
done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> no
看到如下提示则安装成功
Thank you for installing Anaconda3!
=================================================================
Working with Python and Jupyter notebooks is a breeze with PyCharm Pro,
designed to be used with Anaconda. Download now and have the best data
tools at your fingertips.
PyCharm Pro for Anaconda is available at: https://www.anaconda.com/pycharm
2、配置Anaconda环境
如果conda的初始化时选择了no,则需要自行配置环境变量。
打开.bashrc文件
vi /root/.bashrc
在文件最后加入如下语句(路径需要根据自己的安装位置更改)
export PATH="/root/anaconda3/bin:$PATH"
按住shift键+:键,输入wq,保存文件并退出
刷新环境变量
source ~/.bashrc
进入、退出环境使用的也是source开头的命令
# 进入conda环境 出现(base)则说明安装成功
source activate
# 退出conda环境
source deactivate
3、常用命令
详情查看本站文章:Conda常用命令
评论区