Install Python-001

Building Python and more on missing modules

Here is how to build Python and fix any dependencies. I am assuming that you want this Python to be entirely separate from the Ubuntu release Python, so I am specifying the –prefix option to install it all in /home/python27 using the standard Python layout, i.e. site-packages instead of dist-packages.

1. Get the .tar.gz file into your own home directory.
2. tar zxvf Py*.tar.gz
3. cd Py*1
4. ./configure --prefix=/home/python27
5. make
6. make install

Step 5 is the important one. At the end, it will display a list of any modules that could not be built properly. Often you can fix this by installing an Ubuntu package, and rerunning make.

a. sudo apt-get install something-dev
b. make

It is pretty common to have a problem because you are missing the -dev addon to some module or other. But sometimes you should start over like this:

a. make clean
b. ./configure --prefix=/home/python27
c. make

Starting over never hurts if you are unsure. An important note about step 6. I am not using sudo on this command which means that you will need to have the /home/python27 directory already created with the appropriate ownership.

Don’t hesitate to try out ./configure --help |less before building something because there may be interesting options that you could use. One time on a minimal distro I had to do –with-dbmliborder=gdbm:bdb in order to get gdbm working. When you run ./configure, the last few lines will tell you where it put the information that it learned. In the case of Python, Modules/Setup has been useful to figure out how to get a module to build.

Another useful thing is to make clean and then run make >make.out 2>&1 to capture all the output from the full make process. Then, after it is complete, use less or an editor to look for the details on a problem module such as _sqlite. For instance, check all the -I options that are passed to gcc. If the correct include directory is not on the list that would cause a problem. You can edit setup.py to change the list of include directories.

In the past it was more common to have library problems that would be fixed by logging out, logging in again, and running “sudo ldconfig” before doing a complete rebuild.

 

Reference from :

http://stackoverflow.com/questions/6171210/building-python-and-more-on-missing-modules

 

Run the following to install libpng && zlib libraries for openssl

sudo apt-get install libpng-dev

You can use following to install openssl after or

sudo apt-get install libssl-dev

OR

./config --prefix=/usr                  \
          --openssldir=/etc/ssl         \
          --libdir=lib                  \
          shared                        \
          zlib-dynamic && make depend   \
        && make

and then run following to install openssl

sudo su

make MANDIR=/usr/share/man MANSUFFIX=ssl install &&
install -dv -m755 /usr/share/doc/openssl-1.0.2h  &&
cp -vfr doc/*     /usr/share/doc/openssl-1.0.2h

exit

and then

##### ./configure --prefix=/usr \ ----- change the installation directory
./configure --prefix=/usr/Python2712 \
            --enable-shared     \
            --with-system-expat \
            --with-system-ffi   \
            --enable-unicode=ucs4 &&
make

make -k test

sudo su

##### make install &&
or make altinstall &&
chmod -v 755 /usr/lib/libpython2.7.so.1.0

exit

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s