⚒️ Python Local Setup Cheatsheet
⚒️ Python Local Setup Cheatsheet
Python is a common runtime for many automation tasks, and local setup remains relevant even though you can containerize your scripts or applications — convenience is still king.
Python version manager
- pyenv/pyenv: Simple Python version management
- pyenv/pyenv-virtualenv: a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
Commands
brew install pyenv(Installing via Homebrew is still the easiest option.)- You may need the following commands to enable pyenv to auto-load in your default shell environment.
1 2 3
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc
pyenv install -l(List all available Python versions)pyenv install(Install the Python version according to local.python-versionfile)pyenv local xxx(Lock a Python version locally)brew install pyenv-virtualenv(Install virtualenv to provide additional package isolation for each project.)- You may need the following commands to enable pyenv-virtualenv to auto-load in your default shell environment.
1
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc
This post is licensed under CC BY 4.0 by the author.