Installation¶
To get started with Python, you need to install multiple tools on your system.
pyenv and pyenv-virtualenv¶
pyenv is a version manager for Python. It allows to install multiple versions of Python on the same machine.
pyenv-virtualenv is a plugin for pyenv that helps to manage virtualenv.
Installation¶
Install it using Homebrew, along with build dependencies
Configure your shell (bash)
Install build dependencies
sudo apt-get update
sudo apt-get install -y \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
curl \
libncursesw5-dev \
xz-utils \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
libffi-dev \
liblzma-dev \
git
Install pyenv and pyenv-virtualenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
Configure your shell (bash)
Add the following snippet to your .zshrc
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH=$PYENV_ROOT/shims:$PATH
zinit ice atclone'./libexec/pyenv init - > zpyenv.zsh && git clone https://github.com/pyenv/pyenv-virtualenv ./plugins/pyenv-virtualenv && ./libexec/pyenv virtualenv-init - >> zpyenv.zsh' \
atpull'./libexec/pyenv init - > zpyenv.zsh && cd ./plugins/pyenv-virtualenv && git pull && cd ../.. && ./libexec/pyenv virtualenv-init - >> zpyenv.zsh' \
as'command' pick'bin/pyenv' src"zpyenv.zsh" nocompile'!'
zinit light pyenv/pyenv
exec "$SHELL"
pipx¶
pipx is an application manager for Python. It creates a dedicated virtualenv for each application and adds it to your PATH.
Install it using Homebrew
Configure your shell (bash)
poetry¶
poetry is a package manager for Python.
Install it using pipx
pip-tools¶
pip-tools is a lightweight alternative to poetry for small projects and simple use cases.
Install it using pipx