Tuesday 9 April 2013

Steps to Install Python3 in Linux through Command Line

To Install Python3 in linux through Command line follow below commands

Dependencies for Python3 is gcc and some times zlib-devel so install these first

in redhat ( RHEL ), fedora etc
commands are
root@bt:~# yum install gcc
root@bt:~# yum install zlib-devel

in Ubuntu, Linux Mint etc
commands are

root@bt:~# apt-get install gcc
root@bt:~# apt-get install zlib-devel

Download latest version of Python3 (  bzipped source tarball)  from http://www.python.org/download/ 
Now it is Python-3.3.1.tar.bz2
root@bt:~# wget http://www.python.org/ftp/python/3.3.1/Python-3.3.1.tar.bz2

Extract It
root@bt:~# bzip2 -cd Python-3.3.1.tar.bz2 | tar xvf -

Goto Extracted Folder
root@bt:~# cd Python-3.3.1

Configure Python3

root@bt:~/Python-3.3.1# ./configure --prefix=/opt/python3

root@bt:~/Python-3.3.1# make

root@bt:~/Python-3.3.1# make install

Add Shortcut
root@bt:~/Python-3.3.1# ln -s /opt/python3/bin/python3 /usr/bin/python3

Use Python3
root@bt:~/Python-3.3.1# python3

Python 3.3.1 (default, Apr  9 2013, 12:32:54) 
[GCC 4.4.5 20101112 (Red Hat 4.4.5-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.

Share This!

No comments:

Post a Comment

Here We Write The Problems we face at different situations and Solutions to those problems.