Skip to content

Latest commit

 

History

History
118 lines (94 loc) · 2.53 KB

conda.md

File metadata and controls

118 lines (94 loc) · 2.53 KB
tags: Tools Python conda DataScience

Install

Miniconda

Miniconda

  1. 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
      
  2. Install using root privilege, and specify the installation location as /usr/local/miniconda3/

  3. 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 <<<
  1. (Optional) Execute the following command to deactivate the default base environment:
conda config --set auto_activate_base false
Miniforge

Miniforge

__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

Commands

Commonly used

Create an environment

conda create --name my_new_env python=3.8

Enable environment to use by activate

conda activate my_new_env

Leave the enviroment

conda deactivate my_new_env

Check the total environment in the machine

conda env list

Remove Environment

conda env remove -n ENV_NAME

Conda with open cv

conda create --name cvenv python=3.8 
conda install --file requirements.txt
conda install -c conda-forge opencv

Save Environment package to requirement.txt

  • save env.yml
conda env export > environment.yml --no-builds
  • install from env.yml
conda env create -f environment.yml