Degen Code

Degen Code

Share this post

Degen Code
Degen Code
How To Easily Manage Python Versions and Virtual Environments
Copy link
Facebook
Email
Notes
More

How To Easily Manage Python Versions and Virtual Environments

Keep Your Sanity — Use PyEnv

Feb 22, 2024
∙ Paid
1

Share this post

Degen Code
Degen Code
How To Easily Manage Python Versions and Virtual Environments
Copy link
Facebook
Email
Notes
More
Share

PyEnv takes the awful parts of Python environment management and makes them decidedly not awful.

Not the sort of thing you’d force into conversation at a party, but getting this set up will really improve your Python experience.

I learned about PyEnv during the twilight chapters of my Brownie days. When I first started using the tool, Python 3.9 was typically available on most Linux installations. Installing Brownie was simple, just run a bit of pip install magic and you were good to go. The eventual upgrade to Python 3.10 was fairly painless, too, assuming you already had a working Python 3.9 virtual environment. A fresh install with Python 3.10 was a different matter, of course.

Eventually I wanted to upgrade my OS to a release with Python 3.11 as the system default, so I needed a real solution that would let me continue using Python 3.9 for my Brownie tooling.

There are other options for managing multiple Python versions, including Conda/Miniconda. I tried Conda first because I’d used it on Windows many years ago, but finally chose PyEnv after giving it a serious test run.

PyEnv is designed to work correctly on a POSIX/UNIX-style system, which means native Linux or MacOS via homebrew. Apparently PyEnv can work on Windows through WSL, but I have no experience with that and recommend that Windows users just stick with Conda.

Installing PyEnv

Simply follow the installation instructions on the PyEnv Github page and you should be set without much trouble.

PyEnv relies on a set of “shims” that intercept calls to Python and dispatch them to the appropriate version inside a running shell. They are critical and must be functional for anything PyEnv-related to work.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 BowTiedDevil
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More