modified: content/2011-09-08-a-system-administrators-guide-to-installing-and-maintaining-multiple-python-environments.rst
modified: template_new_entry.rst
This commit is contained in:
parent
c0abe32b2f
commit
12e610d412
2 changed files with 51 additions and 10 deletions
|
|
@ -1,11 +1,14 @@
|
||||||
A system administrators guide to installing and maintaining multiple python environments
|
A system administrators guide to installing and maintaining multiple python environments
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
||||||
:date: 2011-09-08 19:28
|
:date: 2011-09-08 19:28
|
||||||
:author: Russell Ballestrini
|
:author: Russell Ballestrini
|
||||||
:tags: DevOps, Guide
|
:tags: DevOps, Guide
|
||||||
:slug: a-system-administrators-guide-to-installing-and-maintaining-multiple-python-environments
|
:slug: a-system-administrators-guide-to-installing-and-maintaining-multiple-python-environments
|
||||||
:status: published
|
:status: published
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
|
||||||
Some operating systems depend on a specific version of python to
|
Some operating systems depend on a specific version of python to
|
||||||
function properly. For example, Yum on Redhat Enterprise Linux 5 (RHEL5)
|
function properly. For example, Yum on Redhat Enterprise Linux 5 (RHEL5)
|
||||||
depends on python 2.4.3. This version of python lacks support from many
|
depends on python 2.4.3. This version of python lacks support from many
|
||||||
|
|
@ -13,11 +16,21 @@ utilities and 3rd party libraries. This guide will cover installing an
|
||||||
alternative python instance while leaving the system's python alone.
|
alternative python instance while leaving the system's python alone.
|
||||||
|
|
||||||
*This guide supports the following operating systems: Redhat, CentOS,
|
*This guide supports the following operating systems: Redhat, CentOS,
|
||||||
and Fedora. As of this publication the latest Python version was 2.7.2;
|
and Fedora. As of this publication the latest Python version was 2.7.8;
|
||||||
You might want to determine if a newer version exists.*
|
You might want to determine if a newer version exists.*
|
||||||
|
|
||||||
Compile
|
Install Python 2.7
|
||||||
=======
|
==================
|
||||||
|
|
||||||
|
I found two methods which work for installing Python 2.7 side-by-side with the system's Python.
|
||||||
|
|
||||||
|
* compile from source
|
||||||
|
* install package via the *scl* repo
|
||||||
|
|
||||||
|
Choose which ever strategy you find easier.
|
||||||
|
|
||||||
|
Compile from source
|
||||||
|
-------------------
|
||||||
|
|
||||||
#. Gather the dependencies::
|
#. Gather the dependencies::
|
||||||
|
|
||||||
|
|
@ -30,9 +43,9 @@ Compile
|
||||||
|
|
||||||
#. Download and untar the python sourcecode::
|
#. Download and untar the python sourcecode::
|
||||||
|
|
||||||
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
|
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
|
||||||
tar -xzvf Python-2.7.2.tgz
|
tar -xzvf Python-2.7.8.tgz
|
||||||
cd Python-2.7.2
|
cd Python-2.7.8
|
||||||
|
|
||||||
|
|
||||||
#. Compile the sourcecode::
|
#. Compile the sourcecode::
|
||||||
|
|
@ -44,11 +57,34 @@ Compile
|
||||||
|
|
||||||
python2.7 --version
|
python2.7 --version
|
||||||
|
|
||||||
|
#. Document path to new python2.7, you will need it if you plan to use a virtualenv::
|
||||||
|
|
||||||
|
which python2.7
|
||||||
|
|
||||||
#. Now we can install third party libraries into our alternative python::
|
#. Now we can install third party libraries into our alternative python::
|
||||||
|
|
||||||
python2.7 -m easy_install
|
python2.7 -m easy_install
|
||||||
|
|
||||||
|
Install package from scl
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
#. install centos-release-scl repolists::
|
||||||
|
|
||||||
|
sudo yum install centos-release-scl
|
||||||
|
|
||||||
|
#. install python27::
|
||||||
|
|
||||||
|
sudo yum install python27
|
||||||
|
|
||||||
|
# enable python27 via scl::
|
||||||
|
|
||||||
|
scl enable python27 bash
|
||||||
|
|
||||||
|
#. Document path to new python2.7, you will need it if you plan to use a virtualenv::
|
||||||
|
|
||||||
|
which python2.7
|
||||||
|
|
||||||
|
|
||||||
virtualenv
|
virtualenv
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
@ -57,13 +93,18 @@ python 2.7 install. Virtual environments appear useful for testing
|
||||||
packages and libraries without installing them to the system owned
|
packages and libraries without installing them to the system owned
|
||||||
python site-packages directory.
|
python site-packages directory.
|
||||||
|
|
||||||
#. Install virtualenv using easy\_install::
|
#. Install pip using easy\_install::
|
||||||
|
|
||||||
easy_install virtualenv
|
sudo easy_install pip
|
||||||
|
|
||||||
|
#. Install virtualenv using pip::
|
||||||
|
|
||||||
|
sudo pip install virtualenv
|
||||||
|
|
||||||
#. Create a new virtual python environment named virtpy::
|
#. Create a new virtual python environment named virtpy::
|
||||||
|
|
||||||
virtualenv --no-site-packages -p /usr/local/bin/python2.7 virtpy
|
cd ~
|
||||||
|
virtualenv -p /usr/local/bin/python2.7 virtpy
|
||||||
|
|
||||||
This will create a virtual python 2.7.2 environment named virtpy in your present working directory.
|
This will create a virtual python 2.7.2 environment named virtpy in your present working directory.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
THESLUG
|
THESLUG
|
||||||
=========================================================
|
################################################################
|
||||||
|
|
||||||
:author: Russell Ballestrini
|
:author: Russell Ballestrini
|
||||||
:slug: THESLUG
|
:slug: THESLUG
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue