4

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

2
  • What have you tried? What issue are you having? There's too little information to go off of Jun 27, 2014 at 1:21
  • 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 Jun 27, 2014 at 2:35

1 Answer 1

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

1
  • 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
    Jul 22, 2015 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .