user422005
user422005

Reputation: 2031

Where should python wrapper/package be installed

I am distributing a reasonably large C library; as part of the distribution is a Python wrapper package. The build system is cmake, and make install should copy the Python code to a location in the Python path. Based on reading the Python documentation the default location for the installed Python modules is:

${CMAKE_INSTALL_PREFIX}/lib/pythonX.Y/site-packages

But on Debian based system this path is not on the default Python search path, instead the search path contains /usr/local/lib/pythonX.Y/dist-packages. I would like a default installation to "just work" and wonder what is the best approach with respect to dist-packages versus site-packages? My current plan is:

  1. If on Debian based based system - install to dist-packages.
  2. Else install to site-packages

But maybe dist-packages is only for packages which come with a package manager?

Upvotes: 1

Views: 115

Answers (1)

TavoloPerUno
TavoloPerUno

Reputation: 579

dist-packages are only for packages which come with a package manager.

From debian wiki :

dist-packages instead of site-packages. Third party Python software installed from Debian packages goes into dist-packages, not site-packages. This is to reduce conflict between the system Python, and any from-source Python build you might install manually.

For packaging python modules, refer Section 2.5

Public Python modules not handled by python-central or python-support must be installed in the system Python modules directory, /usr/lib/pythonX.Y/dist-packages for python2.6 and later, and /usr/lib/pythonX.Y/site-packages for python2.5 and earlier. Public Python 3 modules must be installed in /usr/lib/python3/dist-packages.

Upvotes: 1

Related Questions