Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to install python 2.7.2.tgz on Ubuntu, downloaded from http://python.org/download/.

Is this a correct way to install :

./configure
make
make install

If not , how can I do that?

share|improve this question

3 Answers 3

up vote 87 down vote accepted

First, install some dependencies:

sudo apt-get install build-essential
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Then download using the following command:

cd ~/Downloads/
wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz

Extract and go to the dirctory:

tar -xvf Python-2.7.5.tgz
cd Python-2.7.5

Now, install using the command you just tried:

./configure
make
sudo make install
share|improve this answer
    
Thanks for attention . –  Mohammad Feb 5 '12 at 16:18
10  
Use sudo make install and not altinstall to set it as default python version –  Shagun Jul 22 '13 at 14:35
    
use CXX=g++ ./configure if ./configure issues a warning saying g++ was not found –  srj Nov 7 '14 at 11:55
1  
after installing as instructed above, what commands do I run in the console to check that indeed it is installed? –  Ciwan Jan 29 at 10:51

Unless you really have a burning desire to compile it yourself, the preferred way is to use the DeadSnakes PPA to install versions of Python that aren't included by default:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.7
share|improve this answer
    
Thanks for attention. –  Mohammad Feb 5 '12 at 16:18
11  
Program note: If you're on 10.04, you may need to install python-software-properties prior to using add-apt-repository. –  CraigM Apr 9 '12 at 19:59
3  
It's recommended to build python in your local environment, instead of installing it from pre-build binaries –  pylover Oct 22 '13 at 1:10
4  
+1 :) really have a burning desire to compile it yourself –  Watt Nov 13 '13 at 22:35
    
Missed to mention that: 1. the ppa is not officially endorsed, so the most secure way is to build from source. 2. this will result in a global python, that non-sudoers cannot modify or install packages to, not a local one. 3. Multiple pythons can be installed locally at different locations by building from source. –  Ioannis Filippidis Aug 9 '14 at 1:06

12.04

If you are following Achu's answer, then the term libread5-dev should be changed to libreadline-gplv2-dev. So the full command would be:

sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
share|improve this answer

protected by Community Jan 31 at 0:21

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.