Installing Python on Shared Server

By | December 14, 2004

Note to Self for Future

The following steps are for installing Python 2.4 on a shared server. After ssh’ing to the server:

$ wget http://python.org/ftp/python/2.4/Python-2.4.tgz
$ cd Python-2.4
$ ./configure --prefix=$HOME/lib
$ make && make install
$ ln -s $HOME/lib/bin/python $HOME/bin/python/bin/python

Credits: Thanks to Uche Ogbuji for publishing IRC transcript excerpts that reminded of the steps I had forgotten, though I did use my somewhat stranger directory structure for the symbolic link.

3 thoughts on “Installing Python on Shared Server

  1. scott

    I just followed your instructions to install python2.4, and it seems much slower than the python2.1 or pythong2.2 that were already installed on my server (pogo).

    For example, just entering the python interactive mode takes several seconds in 2.4. Any ideas on how to speed this up?

    Reply
  2. Robert

    I ran a quick test to see if my python 2.4 build was any slower than the DH build of 2.1.3.

    Here’s the code:

    import time, math

    t = time.asctime()
    print t
    x = 1
    for i in range(1000000):
    x = math.tanh(i)
    t = time.asctime()
    print t

    With the DH installed version on the server dali
    Python 2.1.3 (#1, Sep 7 2002, 15:29:56)
    [GCC 2.95.4 20011002 (Debian prerelease)] on linux2
    I got a time of five seconds on five straight runs.

    With my build of python 2.4 on the same server:
    Python 2.4 (#1, Dec 14 2004, 00:04:38)
    [GCC 2.95.4 20011002 (Debian prerelease)] on linux2
    I got times of three seconds on every run but one, which took six seconds. I alternated between versions so as to hopefully mitigate any effects of the shared server being more or less busy at different times.

    Despite the fact that the mathematical performance does seem to be improved, I have also noticed that python 2.4 seems to be slower to start up.

    Unfortunately, that obviously causes a big hit on cgi performance for us, since we don’t have access to mod_python on a DH shared server.

    The built-in python is almost instantaneous to display the interpreter prompt, but my version of python 2.4 can take anywhere from almost instantaneous (maybe a 1/4 second) up to a second.

    Reply
  3. Pingback: Boger’S博客 » Blog Archive » TurboGearsOnDreamHost

Leave a Reply to scott Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.