Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python module in 'dist-packages' vs. 'site-packages'

Tags:

python

debian

I am building a deb package from source. The source used to install the modules in 'site-packages' in RHEL.

On Ubuntu, 'site-packages' doesn't work for me. Searching over the net, it says that python Ubuntu would require it in 'dist-packages'

But there are also references that python built from source would look in 'site-packages'

Now I am confused, where should my deb packages install the modules so that it works irrespective of python built from source or installed from Ubuntu repo

like image 991
mittal Avatar asked Oct 18 '25 22:10

mittal


1 Answers

dist-packages is a Debian convention that is present in distros based on Debian. When we install a package using the package manager like apt-get these packages are installed to dist-packages. Likewise, if you install using pip and pip is installed via package manager then these packages will be installed in dist-packages.

If you build python from source then pip comes with it, now if you install a package using this pip it'll be installed into site-packages.

So It depends on which python binary you are using if you are using the binary that comes from package manager it will search in dist-packages and if you are using a binary from manual install it'll search in site-packages.

like image 103
Priyanshu Jain Avatar answered Oct 20 '25 13:10

Priyanshu Jain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!