Python
Anaconda
Anaconda is an open-source distribution of Python. It comes with the Python interpreter, a package manager and various packages related do data science.
Installing
Anaconda
Download Anaconda executable and follow the instructions to install Anaconda in your system.
https://www.anaconda.com/download
Miniconda
Miniconda is a minimal installation of Conda + Python + other userful packages (pip, zlib ...).
Quick Install
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ~/Miniconda3-latest-Linux-x86_64.sh
Manual installation
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 ~/miniconda3/miniconda.sh
Configure conda autoload:
~/miniconda3/bin/conda init bash
Conda
Conda is the main Anaconda package manager.
conda create --name environment-name python=version: create a new environmentconda activate environment-name: activate the indicated environmentconda deactivate: deactivate the current environmentconda env list: list environmentsconda remove -n environment-name --all: delete environment-nameconda install package-name: install package-nameconda env export > filename.yml: export current environmentconda env create --file filename.yml: create new environment from filename.yml
PIP
pip is the package installer for Python. It allows you to install, update, and manage Python packages and libraries from the Python Package Index (PyPI).
conda install pip: install pip if you are in a fresh conda environmentpip install package-name: install the selected package in the current environmentpip uninstall package-name: uninstall the selected package from the current environment
New Project sample
Imagine that you start a new project with the following requirements:
- python interpreter 3.8
- pyjokes library
You can create a new environment, activate it, install pip, install the required libraries with pip and then execute the script.
conda create --name newproject python=3.8
conda activate newproject
conda install pip
pip install pyjokes