Module Search Path

To look for modules on import...

  • The interpreter searches the directories in sys.path
     ['',
      '/usr/local/lib/python1.5/',
      '/usr/local/lib/python1.5/plat-sunos5',
      '/usr/local/lib/python1.5/lib-tk',
      '/usr/local/lib/python1.5/lib-dynload',
      '/usr/local/lib/python1.5/site-packages',
      '/usr/local/lib/site-python/'] 
  • New directories can be added to the path as needed
     import sys
     sys.path.append("/home/beazley/python")
<<< O'Reilly OSCON 2000, Introduction to Python, Slide 106
July 17, 2000, beazley@cs.uchicago.edu
>>>