Introduction to Python 2

The Python 2 package contains the Python development environment. It is useful for object-oriented programming, writing scripts, prototyping large programs or developing entire applications. This version is for backward compatibility with other dependent packages.

This package is known to build and work properly using an LFS-7.5 platform.

Package Information

Additional Downloads

Optional HTML Documentation

Python 2 Dependencies




Optional (For Additional Modules)

Berkeley DB-6.0.30, OpenSSL-1.0.1g, SQLite- and Tk-8.6.1

User Notes:

Installation of Python 2

Install Python 2 by running the following commands:

patch -Np1 -i ../Python-2.7.6-readline_6_3-1.patch &&
./configure --prefix=/usr       \
            --enable-shared     \
            --with-system-expat \
            --with-system-ffi   \
            --enable-unicode=ucs4 &&

To test the results, issue: make test.

Now, as the root user:

make install &&
chmod -v 755 /usr/lib/

Since Python 2 is in maintenance mode, and Python 3 is recommended by upstream for development, probably, you do not need to install the documentation. However, if you still want to install documentation for both Python versions, be sure to define PYTHONDOCS variable for the version you want to use, each time you need to consult the documentation. If you have downloaded the preformatted documentation from, install it as the root user:

install -v -dm755 /usr/share/doc/python-2.7.6 &&
tar --strip-components=1 -C /usr/share/doc/python-2.7.6 \
    --no-same-owner -xvf ../python-2.7.6-docs-html.tar.bz2      &&
find /usr/share/doc/python-2.7.6 -type d -exec chmod 0755 {} \; &&
find /usr/share/doc/python-2.7.6 -type f -exec chmod 0644 {} \;

Command Explanations

--with-system-expat: This switch enables linking against system version of Expat. Remove if you have not installed expat-2.1.0.

--with-system-ffi: This switch enables linking against system version of libffi. Remove if you have not installed libffi-3.0.13.

--enable-unicode=ucs4: This switch enables 32bit Unicode support in Python.

--with-dbmliborder=bdb:gdbm:ndbm: Use this switch if you want to build Python DBM Module against Berkeley DB instead of GDBM.

chmod ...: Fix permissions for libraries to be consistent with other libraries.

Configuring Python 2

In order for python to find the installed documentation, you must add the following environment variable to individual user's or the system's profile:

export PYTHONDOCS=/usr/share/doc/python-2.7.6


Installed Programs: 2to3, pydoc, python, python-config, python2, python2-config, python2.7, python2.7-config,, and optionally if Tk is installed, idle
Installed Library:
Installed Directories: /usr/include/python2.7, /usr/lib/python2.7, and /usr/share/doc/python-2.7.6

Short Descriptions


is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code.


is a wrapper script that opens a Python aware GUI editor.


is the Python documentation tool.


is an interpreted, interactive, object-oriented programming language.


is a version-specific name for the python program.

is an SMTP proxy implemented in Python.

Last updated on 2014-04-02 14:55:33 +0000