Deepin 安裝配置Conda

下載Miniconda

從清華鏡像源下載Miniconda(Miniconda3-latest-Linux-x86_64.sh)

安裝Miniconda

切換到下載文件目錄下,打開終端,輸入命令

sudo bash Miniconda3-latest-Linux-x86_64.sh

出現Do you accept the license terms? [yes|no] 時,輸入yes ,回車

出現

Miniconda3 will now be installed into this location:
/root/miniconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

時,輸入安裝目錄/opt/miniconda3 ,回車。當然也可以選擇其他目錄。
接下來的問題選擇默認。

在~/.bashrc文件末尾加入一行代碼如下:

export PATH=/opt/miniconda3/bin:$PATH

再解決權限問題,這裏的username是你的用戶名

sudo chown -R username:username /opt/miniconda3

到這裏,算是安裝完成。

配置清華鏡像(可選)

這樣,清華校內的同學可以省流量了,且速度超快。

在終端輸入

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

更新conda

打開終端,輸入命令

conda update conda

創建python環境

創建一個名爲mylab的python環境

conda create -n mylab python=3.7

開啓和關閉環境的方法:

開啓:conda activate mylab

關閉:conda deactivate

安裝常用python包

開啓mylab環境:打開終端,輸入

conda activate mylab

設置pip默認源爲清華源:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

安裝常用包:

conda install numpy mkl scipy pandas matplotlib scikit-learn jupyterlab

關閉mylab環境:

conda deactivate

如何刪除Python環境?

conda remove -n mylab --all
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章