I am just getting into Python, and accidentally deleted my default PYTHONPATH. Can someone please tell me what paths are included in a clean Python install? Thanks!
1 Answer
Normal, "clean" installations of Python don't require the use of $PYTHONPATH
: the default path embedded in the interpreter already contains all the locations that are needed to find the standard library. You can prove this by running Python directly with a blank value for $PYTHONPATH
and asking it to output the path in use:
PYTHONPATH= python -c 'import sys; print(sys.path)'
You will get many directories of output from this.
If you have modules installed in non-standard locations (perhaps for example somewhere in your home directory because you are not root and don't have permission to install modules from PyPI in system directories) then you may indeed need a $PYTHONPATH
to tell Python where to find these, but nobody else but yourself knows what these alternate locations are in your case.