Miniconda
-
Download the corresponding version from the official website.
- e.g.
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh chmod +x ./Miniconda3-latest-Linux-x86_64.sh ./Miniconda3-latest-Linux-x86_64.sh
- e.g.
-
Install using root privilege, and specify the installation location as /usr/local/miniconda3/
-
Add the following environment variables in the shell (using vim to open ~/.bashrc or ~/.zshrc).
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/local/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/usr/local/miniconda3/etc/profile.d/conda.sh" ]; then
. "/usr/local/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/usr/local/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
- (Optional) Execute the following command to deactivate the default base environment:
conda config --set auto_activate_base false
Miniforge
- https://developer.apple.com/metal/tensorflow-plugin/
- Can work with Mac m1
__conda_setup="$('/usr/local/miniforge3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/usr/local/miniforge3/etc/profile.d/conda.sh" ]; then
. "/usr/local/miniforge3/etc/profile.d/conda.sh"
else
export PATH="/usr/local/miniforge3/bin:$PATH"
fi
fi
unset __conda_setup
Commands
conda create --name my_new_env python=3.8
conda activate my_new_env
conda deactivate my_new_env
conda env list
conda env remove -n ENV_NAME
conda create --name cvenv python=3.8
conda install --file requirements.txt
conda install -c conda-forge opencv
- save env.yml
conda env export > environment.yml --no-builds
- install from env.yml
conda env create -f environment.yml