Install Python 3.3 on CentOS

Problem

How to install Python 3.3 on CentOS

tl;dr

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

Solution

The steps to install Python 3.3 are very similar to those for Python 2.7. Python requires development tools to be installed first:

yum groupinstall development

If you are to use Python in any serious capacity, there are a number of extremely useful development modules that should be installed before Python, so the interpreter can recognize and load them during the installation.

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y

Download the required installer:

wget http://python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz

Uncompress the installer:

tar xf Python-3.3.5.tar.xz
cd Python-3.3.5

Finally, run the install:

./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

This will take about 5-10 minutes, after which Python 3.3 will be ready to use on your system.


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 3790
Related articles: