What is python's site-packages directory?

The directory site-packages is mentioned in various Python related articles. What is it? How to use it?

  • site-packages is the target directory of manually built python packages. When you build and install python packages from source (using distutils, probably by executing python setup.py install), you will find the installed modules in site-packages by default.

  • There are standard locations:

Unix(pure): prefix/lib/pythonX.Y/site-packages

Unix (non-pure): exec-prefix/lib/pythonX.Y/site-packages

Windows: prefix\Lib\site-packages

(pure means that the module uses only python code. Non pure can cantain c/c++ code as well)

  • site-packages is by default part of the python search path, so modules installed there can be imported easily afterwards.

  • A very useful article: https://docs.python.org/2/install/

From: stackoverflow.com/q/31384639