一、安装软件下载
1、官网下载安装包
https://www.anaconda.com/distribution/#linux
下载Linux操作系统的Python 3.7 Version版本安装包
下载文件名:Anaconda3-2019.07-Linux-x86_64.sh
2、wget命令下载安装包
wget https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
二、安装conda
1 、修改安装文件权限为可执行文件
chmod 755 Anaconda3-2019.07-Linux-x86_64.sh
2 、在shell下直接执行文件安装
./Anaconda3-2019.07-Linux-x86_64.sh
3、安装步骤如下:
root@ubuntu:~/tools# chmod 755 Anaconda3-2019.07-Linux-x86_64.sh
root@ubuntu:~/tools# ./Anaconda3-2019.07-Linux-x86_64.sh
\
Welcome to Anaconda3 2019.07
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
【按ENTER键】
===================================
Anaconda End User License Agreement
===================================
Copyright 2015, Anaconda, Inc.
All rights reserved under the 3-clause BSD License:
…
【按ENTER键,直到信息显示结束】
cryptography
A Python library which exposes cryptographic recipes and primitives.
Do you accept the license terms? [yes|no]
[no] >>>
Please answer 'yes' or 'no':'
>>>
Please answer 'yes' or 'no':'
>>> yes
【输入yes,按ENTER键】
…
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] >>>
【按ENTER键】
…
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>>
【输入yes,按ENTER键】
…
If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Anaconda3!
【安装成功】
4、conda官方详细安装过程
https://docs.anaconda.com/anaconda/install/linux/
三、conda常用命令
1、conda -V检验是否安装以及当前conda的版本。
2、conda list 查看安装了哪些包。
3、conda env list 或 conda info -e 查看当前存在哪些虚拟环境
4、conda update conda 检查更新当前conda
四、虚拟环境搭建
1、创建虚拟环境
conda create -n your_env_name python=X.X
your_env_name : 环境名字,在Anaconda安装目录envs文件下找到;
X.X: python版本 2.7/3.6/3.7
2、 激活虚拟环境
Linux: source activate your_env_name
Windows: activate your_env_name
your_env_name--虚拟环境名称
3、安装package
1) conda 安装
conda install -n your_env_name [package]
your_env_name--虚拟环境名称
激活环境下使用
conda install [package]
2)pip3/pip安装
pip3 install [package]
pip install [package]
4、关闭虚拟环境
Linux: source deactivate
Windows: deactivate
5、删除虚拟环境
conda remove -n your_env_name --all
your_env_name--虚拟环境名称
6、卸载 package
1) conda卸载
conda remove --name your_env_name package_name
your_env_name--虚拟环境名称
2) pip3/pip 卸载
pip3 uninstall package_name
pip uninstall package_name