How do I find out my PYTHONPATH using Python?

You can use the sys module in Python to access the sys.path variable, which contains a list of directories that Python looks in for modules to import. Here is a code snippet that you can use to print out the current value of sys.path:

import sys

Watch a course Python - The Practical Guide

The directories listed in sys.path are searched in order, so if multiple versions of a module are found, the version in the first directory in the list will be imported. The first item in the list is the current working directory, followed by directories listed in the PYTHONPATH environment variable, if it is set.