How does python find packages?
When you initiate python, the modules and packages are automatically imported from site.py script. The script essentially point to the location: (in ubuntu) /usr/lib/python2.7 I just ran into a situation where I compiled and installed Python 2.7.9 from source on Ubuntu, but Python could not find the packages I had previously installed. This naturally raises the question - how does Python know where to find packages when you call import ? This post applies specifically to Python 2.7.9, but I'm guessing Python 3x works very similarly. In this post I first describe how Python finds packages, and then I'll finish with the discovery I made regarding the default Python that ships with Ubuntu and how it differs from vanilla Python in how it finds packages. sys.path Python imports work by searching the directories listed in sys.path . Using my default Ubuntu 14.04 Python: > import sys > print '\n' .join ( sys.path ) /usr/