一、安裝軟件下載
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