Monday, September 5, 2016

compiling Python 2.7


Download Python 2.7 from the download page
Extract it. I'll extract it in

carmel@carmel:~$ cd programs/python/Python-2.7.12/

 configure --help

Run 

carmel@carmel:~/programs/python/Python-2.7.12$ ./configure --help

And you'll see the configuration help text.

--prefix

Use the --prefix flag to install python under a custom directory.
I find it useful if you don't want to give the 'make' program root access. (I think it is a very bad practice)

Configuration line should now be 

carmel@carmel:~/programs/python/Python-2.7.12$ ./configure --prefix=/home/carmel

--enable-shared

The help text from the configuration file says:

Optional Features:
   ...
   --enable-shared         disable/enable building shared python library
   ...

I need this since I want to compile vim with python. Without it I won't have the necessary libraries and config files. 
Configuration line should now be 

carmel@carmel:~/programs/python/Python-2.7.12$ ./configure --prefix=/home/carmel --enable-shared


finaly

Run 

carmel@carmel:~/programs/python/Python-2.7.12$ ./configure --prefix=/home/carmel --enable-shared && make && make install