Introduction to Python 3

The Python 3 package contains the Python development environment. This is useful for object-oriented programming, writing scripts, prototyping large programs or developing entire applications.

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

Package Information

Additional Downloads

Optional HTML Documentation

Python 3 Dependencies



BlueZ-5.46, GDB-8.0 (required for some tests), and Valgrind-3.13.0

Optional (For Additional Modules)

Berkeley DB-6.2.32, OpenSSL-1.1.0f, SQLite-3.20.0 and Tk-8.6.7

User Notes:

Installation of Python 3

Install Python 3 by running the following commands:

CXX="/usr/bin/g++"              \
./configure --prefix=/usr       \
            --enable-shared     \
            --with-system-expat \
            --with-system-ffi   \
            --with-ensurepip=yes &&

The test suite must be run separately, using an X terminal (see below).

Now, as the root user:

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

If you have downloaded the preformatted documentation from, install it as the root user:

install -v -dm755 /usr/share/doc/python-3.6.2/html &&
tar --strip-components=1 \
    --no-same-owner \
    --no-same-permissions \
    -C /usr/share/doc/python-3.6.2/html \
    -xvf ../python-3.6.2-docs-html.tar.bz2

The test suite must be run separately from the build, either before or after the package is built and installed. Do not run make install, after running the test suite. To build and install the package, you need to start with a fresh or clean source tree. For the test, you also need a clean source code, so either start by removing the source code directory and starting over, by uncompressing the source tarball or by running make clean. Then configure again, adding “--with-pydebug” to the configure switches above, run make, then make test. Remember that tests must be executed using an X terminal. One test fails. The test SBU highly depends on the speed of the internet connexion.

Command Explanations

CXX="/usr/bin/g++" ./configure ...: Avoid an annoying message during configuration.

--with-system-expat: This switch enables linking against the system version of Expat.

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

--with-ensurepip=yes : This switch enables building pip and setuptools packaging programs. setuptools is needed for building some Python modules.

--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 shared libraries to be consistent with other libraries.

Configuring Python 3

In order for python3 to find the installed documentation, create the following version independent symlink:

ln -svfn python-3.6.2 /usr/share/doc/python-3

and add the following environment variable to the individual user's or system's profile:

export PYTHONDOCS=/usr/share/doc/python-3/html


Installed Programs: 2to3 (symlink), 2to3-3.6, idle3 (symlink), and idle3.6 pydoc3 (symlink), pydoc3.6, python3 (symlink); python3.6 and python3.6m (hardlinked); python3-config (symlink), python3.6-config (symlink), python3.6m-config, pyvenv (symlink), pyvenv-3.6,
Installed Libraries: and
Installed Directories: /usr/include/python3.6m, /usr/lib/python3.6, and /usr/share/doc/python-3.6.2

Short Descriptions


is a wrapper script that opens a Python aware GUI editor. For this script to run, you must have installed Tk before Python so that the Tkinter Python module is built.


is the Python documentation tool.


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


is a version-specific name for the python program.


creates virtual Python environments in one or more target directories.

Last updated on 2017-08-18 12:42:43 -0700