Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

--home or --prefix in python package install?

When you build and install a python package, you have two choices: --home and --prefix. I never really got the difference between the two (I always use --home) but if I understood correctly one is deprecated and the other is "the way to go"™.

Am I wrong ?

like image 684
Stefano Borini Avatar asked Oct 15 '22 14:10

Stefano Borini


1 Answers

According to the Installing Python Modules documentation, the "standard" way is to specify neither, and to let Python install it in either /usr/local/lib/pythonX.Y/site-packages on *nix or C:\Python\ on Windows.

But, if you do decide to go for an alternate method, you can specify --home to name the base installation directory, typically when you want to store multiple packages in just your own directory, usually on a multi-user machine when you don't have admin access, or perhaps for just testing before a system-wide install. --home is not deprecated; in fact, it was only added to Windows as of Python 2.4.

The --prefix option is more strange, because this lets you use one version of Python to build the module you're installing, while letting you install the module to a different location from normal. Another example is when you have to write to a directory with one name, while reading from it with another name (some network shares are set up this way).

So the --home prefix specifies home/lib/python, home/bin, home/share, while the --prefix option specifies prefix/lib/pythonX.Y/site-packages/, prefix/bin, prefix/share on *nix and prefix/Scripts and prefix/Data on Windows.

like image 140
Mark Rushakoff Avatar answered Oct 18 '22 13:10

Mark Rushakoff