Fix Python – What is python’s site-packages directory?


Asked By – Omer Dagan

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

Now we will see solution for issue: What is python’s site-packages directory?


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 install), you will find the installed modules in site-packages by default.

There are standard locations:

  • Unix (pure)1: prefix/lib/pythonX.Y/site-packages
  • Unix (non-pure): exec-prefix/lib/pythonX.Y/site-packages
  • Windows: prefix\Lib\site-packages

1 Pure means that the module uses only Python code. Non-pure can contain 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.

Useful reading

This question is answered By – Omer Dagan

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0