How to install Python 2.7 on Ubuntu 9.10
Question: Now we're developing our software on the customer side, and there is:

    
    
    maestro@UIServer:~$ cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=9.10
    DISTRIB_CODENAME=karmic
    DISTRIB_DESCRIPTION="Ubuntu 9.10"
    

system is installed. We're not allowed to upgrade this system to a newer
version, but we need to use Python 2.7 in our project.

E.g. we have to use pymorphy2 package, but when we're trying to import it into
project, we get:

    
    
    >>> import pymorphy2
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/site-packages/pymorphy2/__init__.py", line 3, in <module>
        from .analyzer import MorphAnalyzer
      File "/usr/local/lib/python2.7/site-packages/pymorphy2/analyzer.py", line 10, in <module>
        from pymorphy2 import opencorpora_dict
      File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/__init__.py", line 4, in <module>
        from .storage import load_dict as load
      File "/usr/local/lib/python2.7/site-packages/pymorphy2/opencorpora_dict/storage.py", line 24, in <module>
        from pymorphy2.utils import json_write, json_read
      File "/usr/local/lib/python2.7/site-packages/pymorphy2/utils.py", line 5, in <module>
        import bz2
    ImportError: No module named bz2
    

Ok, we're trying to install libbz2-dev:

    
    
    sudo apt-get install libbz2-dev
    

end getting this:

    
    
    ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.6
    dpkg: error processing python-pip (--configure):
     subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
     python-pip
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

How to avoid this problem?

Thanks in advance!


Answer: Download [python](https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz),
build and install using :

    
    
    $ ./configure
    $ make
    $ make install
    

I am assuming you have `build-essential` installed or at least `gcc`. You can
customize installation by passing
`prefix=/path/where/you/want/python/installed` and other flags to `make`.

