🐍

【Anaconda】Command Snippet

2023/02/02に公開

INSTALLATION

INSTALL Mini-Conda

cd ~
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
~/miniconda3/bin/conda init zsh
# May be logout or restart or re-open terminal to effect changes.

VIRTUAL ENVIRONMENT

Create new virutal enviroment

Basic venv creation

conda create --name <your_venv>

In this case, specifing python3.10.8 for the base.

conda create --name <your_venv> -c conda-forge python=3.10.8

pandas & numpy will be installed from conda-forge if you run code below.

conda create --name <your_venv> -c conda-forge python=3.10.8 pandas numpy

To OVERWIRTE venv, "--force" at the end of code to force creation.

conda create --name <your_venv> -c conda-forge python=3.10.8 pandas --force

Uninstall Library

conda uninstall <library>

ANACONDA & PIP

pip is also availble for anaconda enviroment.

For instance, you can select python version and use pip for packages as you see below.
Useful for pyenv haters. v3v

conda create --name your_venv python=3.xx.x
pip install -r requirements.txt

NOTE

Freeze dependency.

conda list --export >myenv.txt

Discussion