文章僅是記錄自己的學(xué)習(xí)使用,有錯誤請指出,我立刻改正!
官方說明:https://docs.conda.io/en/latest/miniconda.html
一、下載安裝
mkdir miniconda #創(chuàng)建文件夾
cd miniconda
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh #下載安裝包
bash Miniconda3-latest-Linux-x86_64.sh #執(zhí)行程序
#Ctrl+C跳過閱讀過程,按照提示,輸入yes,然后按回車鍵,同意軟件協(xié)議條款。接下來繼續(xù)按回車,將miniconda安裝到電腦上
conda -V #查看軟件是否安裝完成
#重啟終端之后,便可以使用miniconda了
二、設(shè)置鏡像
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
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
三、常用命令
##Linux下查看已有虛擬環(huán)境##
conda-env list
##創(chuàng)建虛擬環(huán)境##
conda create -n evn_name sorftware_name
##刪除虛擬環(huán)境操##
conda remove -n evn_name --all
##激活環(huán)境
conda activate evn_name
##退出環(huán)境
conda deactivate
##查看環(huán)境下已有的安裝包##
conda list
##重命名環(huán)境##
#conda 其實沒有重命名指令,實現(xiàn)重命名是通過 clone 完成的,分兩步:
#1、先 clone 一份 new name 的環(huán)境
#2、刪除 old name 的環(huán)境
conda create -n new_env_name --clone nlp
conda remove -n env_name --all
四、問題報錯(linux)
(一)“CondaHTTPError: HTTP 000 CONNECTION FAILED”
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/linux-64/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
'https://repo.anaconda.com/pkgs/main/linux-64'
- 原因:可能是所在的網(wǎng)絡(luò)由于某些信息無法訪問默認(rèn)conda網(wǎng)絡(luò)完成驗證所導(dǎo)致。
(二)解決方案:
##配置清華鏡像源##
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
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 --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --set show_channel_urls yes
##修改配置文件##
#1、修改conda配置信息(刪除 - defaults 增加 ssl_verify: false,如果不太清楚如何修改,直接把下方內(nèi)容替換掉~/.condarc中的內(nèi)容)
#2、conda默認(rèn)配置文件為 ~/.condarc ,如不存在使用 conda config --show-sources 查看配置文件位置
vim ~/.condarc
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
show_channel_urls: true
ssl_verify: false