How to download, compile, and install Python on Ubuntu/Debian/ CentOS Linux

 

Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.

Please use md5 checksum to make sure the downloaded files are not corrupt. Also, $ before commands mean you can run the command as ordinary user and # means you have to run the command as root (or use $ sudo )

 

$ wget http://www.python.org/ftp/python/2.7/Python-2.7.tgz
$ tar xzf Python-2.7.tgz
$ cd Python-2.7
$ ./configure --with-pth --with-dec-threads --with-signal-module --prefix=/opt/python-2.7
$ make
# make install

 

This should insall Python 2.7 in /opt/python-2.7. I symlinked /opt/python to /opt/python-2.7/ to make it the default Python installation on my machine.

Please feel free to use the comments form below if you have any questions or need more explanation on anything.

Tags

linux, debian, installation, opensource, ubuntu, python,

Popular Searches

linux, php, mysql mysql, mysql, ubuntu, install mysql, gearman, tools, java, source code

more>>

Comments (write a comment):

Thanks a ton! This really helped!

Thank you!

My company is looking for freelance python coders, can you suggest anyone?

Thanks so much!!! This is extremely helpful

This really helped. Thank you very much.

$ make install
gcc -pthread -Xlinker -export-dynamic -o python \
Modules/python.o \
libpython2.7.a -lpthread -ldl -lutil -lm -threads
gcc: error: unrecognized option ‘-threads’
make: *** [python] Error 1


Thoughts?

hello sir,
thanks for help, it's installing on ubantu 12.04, but when i giving make command it's giving error>>

root@deep-Aspire-5745:/home/deep/Python-2.7# make
gcc -pthread -Xlinker -export-dynamic -o python \
Modules/python.o \
libpython2.7.a -lpthread -ldl -lutil -lm -threads
gcc: error: unrecognized option ‘-threads’
make: *** [python] Error 1
root@deep-Aspire-5745:/home/deep/Python-2.7#

please help me

 

Comment