Howto- Install Python 3.x in Ubuntu, Debian, Fedora & Centos
Question: How to install Python 3.x in Ubuntu, Fedora & Centos?
1- To be able to compile Python Source, you will need few packages. Open terminal and execute this command
- For Centos/Fedora
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
- For Ubuntu/ LinuxMint/Debian
sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev
2- Download latest release of Python
Fetch and extract source. Please refer to http://www.python.org/download/releases to ensure the latest source is used.
3- Extract and cd the extracted directory
tar -xjf Python-3.xtar.bz2 cd Python-3.x
4- Configure the build with a prefix (install dir) of /opt/python3, compile, and install.
./configure --prefix=/opt/python3 make sudo make install
Python 3 will now be installed to /opt/python3.
$ /opt/python3/bin/python3 -V Python 3.x
5- Ensure your python 3 scripts and applications query the correct interpreter.
That is all.