1.下載Anaconda安裝腳本:
首先,訪問Anaconda的官方下載頁面:https://www.anaconda.com/products/distribution
在頁面上,選擇適用于Linux的Python 3.x版本的Anaconda安裝腳本。也可以使用wget或curl命令從終端下載。示例:
wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh
2.執行安裝腳本
有兩種方式:
第一種:
bash Anaconda3-2023.09-0-Linux-x86_64.sh
第二種:
-- 讓腳本可執行
chmod +x Anaconda3-2023.09-0-Linux-x86_64.sh
-- 執行腳本
./Anaconda3-2023.09-0-Linux-x86_64.sh
3.安裝過程
1.查看安裝協議,按下enter查看,如果enter之后不想查看,直接ctrl+c即可到下一步
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
2.是否接受協議,輸入yes
Do you accept the license terms? [yes|no]
[no] >>> yes
3.選擇安裝目錄,有三種選擇
- 按下enter直接安裝到/root/anaconda3目錄下
- 按下ctrl+c退出安裝
- 指定安裝位置,輸入自己的安裝路徑;如果只輸入了一個目錄,則會安裝到執行命令的目錄下。
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] >>> anaconda
4.是否自動化conda環境
大致內容如下:
- 每次啟動終端,是否自動激活conda環境,默認環境通常是base,
- 自動激活會更新系統配置文件,啟動終端時,會提示你激活的是哪個conda環境
- 如果不希望每次啟動終端都激活conda環境,執行命令:conda config --set auto_activate_base false
- 如果開始選擇自動化初始conda,但后來不決定這么做,可以執行命令:conda init --reverse $SHELL
installation finished.
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,run the following command when conda is activated:conda config --set auto_activate_base falseYou can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> yes
5.測試安裝
重新打開窗口,驗證conda是否安裝成功
conda list
安裝anaconda后,就可以使用conda來創建新的環境、安裝包、更新包等。anaconda可能會占用大量磁盤空間,它包含了許多預安裝的庫,如果不需要預安裝很多庫,可以使用miniconda。