What About a Package Manager?

00:00 Now that you’ve decided not to use system Python, the next logical place to look is package managers. Programs such as apt, yum, brew, or port are typical next options. After all, this is how you install most packages to your system.

00:19 Unfortunately, you’ll find some of the same problems using a package manager.

00:26 By default, package managers tend to install their packages into the global system space instead of the user space. Again, these system-level packages pollute your development environment and make it hard to share a workspace with others.

00:45 Once again, you still don’t have control over what version of Python you can install. It’s true, some repositories give you a greater selection, but by default, you’re looking at whatever version of Python your particular vendor is up to on any given day.

01:06 Even if you do install Python from a package manager, consider what would happen if you’re writing a package and want to support and test on Python 3.7 up to Python 3.9.

01:21 What would happen on your system when you type python3? How would you switch quickly between the different versions? You can certainly do it, but it is tedious and prone to error.

01:35 Never mind the fact that if you want, for example, PyPy, Jython, or Miniconda, then you’re probably just out of luck with your package manager.

01:47 With these constraints in minds, let’s recap the criteria that would let you install and manage Python versions easily and flexibly. First, install Python in your user space so you have full control and you will have no interference with other users. Second, install multiple versions of Python, which will allow you to test your project with multiple Python versions or work on multiple projects with different Python versions in your user space. Thirdly, specify the exact Python version you want for each specific project. And lastly, switch between the installed versions so you can try stuff out on multiple versions, run tests with multiple versions on a single project, or easily upgrade the Python version for a project.

02:45 pyenv lets you do all of these things and more.

02:52 Now that you know why pyenv would be useful, you’ll learn how to install pyenv on your operating system in the next lesson.

Become a Member to join the conversation.