Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Adding Python to PATH (Summary)

In this video course, you’ve learned how to add Python, or any other program, to your PATH environment variable on Windows, Linux, and macOS. You also learned a bit more about what PATH is and why its internal order is vital to consider. Finally, you also discovered how you might manage your PATH on a UNIX-based system, seeing as it’s more complex than managing your PATH on Windows.

Additional Resources:

Download

Course Slides (.pdf)

12.2 MB

00:00 And that’s a wrap! To review, in this course you learned that the command line searches PATH when looking for commands like python.

00:08 The order of paths matters because they’re searched from left to right. If your python command doesn’t work, you may need to edit PATH, or you may just need to use the py or python3 command instead.

00:20 When editing PATH in Windows, make sure to use the dedicated GUI. And finally, on Mac and Linux, you can update PATH by editing a shell startup script, like .zprofile.

00:32 As promised, here are some additional resources. The first is a guide about how to install and run Python on different operating systems. The second is a primer about how to work with virtual environments in Python.

00:45 And once you understand the basics of virtual environments, a lot of the messiness around which python and pip commands to use gets cleaned up.

00:54 The third is the written tutorial that this course was based on.

00:59 There are also a few tools out there that help you download and install Python onto your computer directly from the command line without running the python.org installer or worrying about PATH or which command to use.

01:13 The first tutorial is about uv, a fairly new and very fast way to manage Python on your computer that doesn’t require Python to already be installed.

01:24 uv does a lot more than just install Python, so this tutorial doesn’t actually cover much of that, but if you’re serious about using Python professionally or just want a more reliable way to install different versions of Python, it’s a good tool to learn.

01:39 The second tutorial is about pyenv, which is used specifically for working with multiple versions of Python on one machine, keeping them up to date, and using different versions for different projects.

01:52 And this has been “How to Add Python to PATH.” Thank you for watching, and see you next time at realpython.com.

Become a Member to join the conversation.