Modern Python Environments - dependency and workspace management
Once you get through the pain of setting up a Python environment for a single "hello world"-esque application, you'll need to go through an even more difficult process of figuring out how to manage multiple environments for multiple Python projects. Some of the projects could be new while others are stale piles of code from ten years ago. Fortunately, there a number of tools available to help make dependency and workspace management easier.
In this article, we'll review the available tools for dependency and workspace management in order to solve the following problems:
- Installing and switching between different versions of Python on the same machine
- Managing dependencies and virtual environments
- Reproducing environments
While you can download and install Python from the official binaries or with your system's package manager, you should steer clear of those approaches unless you're lucky enough to be using the same version of Python for all your current and future projects. Since this is probably not the case, we recommend installing Python with pyenv.
pyenv is tool that simplifies installing and switching between different versions of Python on the same machine. It keeps the system version of Python intact, which is required for some operating systems to run properly, while still making it easy to switch Python versions based on a specific project's requirements.
Back to Top
Unfortunately, pyenv does not work on Windows outside the Windows Subsystem for Linux. Check out pyenv-win if this is the case for you.