Building Python Quickstart

From Apis Networks Wiki

Jump to: navigation, search

Overview

Need to build a newer Python build than what is presently on the servers? This guide is for you! All servers are, until further notice, stuck with Python 2.3 due to legacy internal dependencies on Ensim. Python is very simple to build on the servers. You are expected to have some familiarity with shell access available on the Basic and higher packages.

Building Python

Download Python off of python.org and build.

wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
tar -xvzf Python-2.5.2.tgz
cd Python-2.5.2
./configure --prefix=/usr/local/ --with-pth && make && make install
 

Re-configuring Applications

Many shell scripts that load Python applications will list the first line as #!/usr/bin/python to invoke the python interpreter located in /usr/bin. As we are now using a local build of Python, change the line to #!/usr/local/bin/python.

Any Python modules built against Python 2.3 will need to be rebuilt using Python 2.5. This is as simple as running /usr/local/bin/python setup.py --install.

Although it isn't necessary to specify /usr/local/bin on most installations, it is used to disambiguate. The default shell profile looks under /usr/local/bin before /usr/bin.

Personal tools