4

Python's docs state that sys.path is initialized from the following locations:

  1. the directory containing the input script,
  2. PYTHONPATH, and
  3. "the installation-dependent default".

print(',\n'.join(sys.path)) produces the following output on my system (no script given, no PYTHONPATH set, Ubuntu):

,
/usr/lib/python36.zip,
/usr/lib/python3.6,
/usr/lib/python3.6/lib-dynload,
/home/owl/.local/lib/python3.6/site-packages,
/usr/local/lib/python3.6/dist-packages,
/usr/lib/python3/dist-packages

So, except '' apparently all the directories belong to "the installation-dependent default".

What is the idea behind this directory layout?

Why five different directories? Which modules go where?

Min-Soo Pipefeet
  • 2,208
  • 4
  • 12
  • 31

0 Answers0