Member-only story
Tools — Pyenv — Simple Python Version Management
Introduction
pyenv is a lightweight, open-source tool that lets you install, manage, and switch between multiple Python versions on the same machine, without ever touching your system Python.
Whether you’re maintaining a legacy application on an older interpreter or experimenting with the latest Python release, pyenv gives you complete control over which Python version runs where — globally, per project, or even per shell session.
Let’s try it!
Installation and setup
One line installation
curl -fsSL https://pyenv.run | bashThen few lines of setup
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc
# Then, if you have .profile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init - bash)"' >> ~/.profileSee documentation for more details
pyenv compiles Python from source, so missing system dependencies can break the build — and even a clean compilation doesn’t always…








