Python Site Packages vs Dist Packages

There are certain locations Python looks for installed packages. You can find out the locations :

import sys
print '\n'.join(sys.path)

dist-package in specific to Debian/Ubuntu distros. The modules that comes from a Debian Package manager are installed in the dist-packages. /usr/lib/python2.7/dist-packages

Since pip also comes from a Debian package manager, they too use ‘dist-packages’ in Debian/Ubuntu. But their path is ‘a bit’ different. /usr/local/lib/python2.7/dist-packages

But if you install Python from source, that Python will use site-packages instead of dist-packages.

This dist-package logic exists to separate the two installations separate, because there are many Ubuntu/Debian utilities which relies on the Python that comes pre-packaged.


comments powered by Disqus