2015年5月18日 星期一

Installing Python 2.7.8 from source on Oracle Linux 6.5

http://bicofino.io/blog/2014/01/16/installing-python-2-dot-7-6-on-centos-6-dot-5/


Installing Python 2.7.8 on CentOS 6.5

 | COMMENTS
CentOS 6.5 still come with Python 2.6 and I need 2.7, below a simple tutorial how to achieve this with no pain and not messing with installed Python.

Update CentOS and install development tools

1
2
yum -y update
yum groupinstall -y 'development tools'
Also you need the packages below to enable SSL, bz2, zlib for Python and some utils:
1
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget

Installing Python 2.7.8 from source

Download Python and extract it
1
2
3
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
xz -d Python-2.7.8.tar.xz
tar -xvf Python-2.7.8.tar

Installation process

Since we already installed all the dependencies we are ready to go:
1
2
3
4
5
6
7
8
9
10
11
12
13
# Enter the directory:
cd Python-2.7.8

# Run the configure:
./configure --prefix=/usr/local

# compile and install it:
make
make altinstall

# Checking Python version:
[root@nicetry ~]# python2.7 -V
Python 2.7.8
If you need set PATH variable check the line below:
1
export PATH="/usr/local/bin:$PATH"

Installing pip and virtualenv

Now we have Python installed, but something is missing isn’t? Yes! We need pip and virtualenv.

Install setuptools

1
2
3
4
5
6
7
8
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz

# Extract the files:
tar -xvf setuptools-1.4.2.tar.gz
cd setuptools-1.4.2

# Install setuptools using the Python 2.7.8:
python2.7 setup.py install

Installing pip

1
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 -

And finally virtualenv

1
pip2.7 install virtualenv
And that’s all, we have Python 2.7.8 installed on CentOS.

沒有留言:

張貼留言

2007 to 2023 HP and Dell Servers Comparison

  HP Gen5 to Gen11  using ChatGPT HP ProLiant Gen Active Years CPU Socket Popular HP CPUs Cores Base Clock Max RAM Capacity Comparable Dell ...