How to Install Python 3.2.2 on CentOS 6.5 amd64 Preserving Its Original Python Installation (2.6.6)?

4

2

How to install Python 3.2.2 on CentOS 6.5 AMD64 preserving its original Python installation (2.6.6)?

Eduardo Lucio

Posted 2014-06-27T01:04:10.713

Reputation: 712

What have you tried? What issue are you having? There's too little information to go off of – Canadian Luke – 2014-06-27T01:21:30.093

Hi Canadian Luke! Thanks for your comment! The question is that! Very objective and specific! I can not imagine what more I can add... Below I answer what I ask! I hope that I have been helpful to this community that I so appreciate! =D – Eduardo Lucio – 2014-06-27T02:35:46.547

Answers

6

Install Python 3.2.2 (CentOS 6.5 AMD64):

In order to compile Python you must first install the development tools and a few extra libs. The extra libs are not strictly needed to compile Python but without them your new Python interpreter will be quite useless

sudo yum groupinstall "Development tools"
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

Here are the commands to download, compile and install Python

cd /usr/local/src
sudo wget http://python.org/ftp/python/3.2.2/Python-3.2.2.tar.xz --no-check-certificate
sudo tar xf Python-3.2.2.tar.xz
cd Python-3.2.2
sudo ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
sudo make && sudo make altinstall

After running the commands above your newly installed Python interpreter will be available as /usr/local/bin/python3.2

/usr/local/bin/python3.2

Download and install Setuptools + pip

cd /usr/local/src
sudo wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo /usr/local/bin/python3.2 ez_setup.py
sudo /usr/local/bin/easy_install-3.2 pip

Create your isolated Python 3.2 environment

sudo /usr/local/bin/pip3.2 install virtualenv
sudo /usr/local/bin/virtualenv /usr/local/virtenv3.2
cd /usr/local/virtenv3.2
source bin/activate
python --version # (To check version)

Source: http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos

Eduardo Lucio

Posted 2014-06-27T01:04:10.713

Reputation: 712

It worked perfectly with Python 3.4 by replacing "3.2" with "3.4" and the Python-3.2.2.tar.xz URL with the 3.4 URL :) – sromero – 2015-07-22T13:28:54.337