Python-3.8.5

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.

[Note]

Note

Python 3 was installed in LFS. The only reason to rebuild it here is if optional modules are needed.

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

Package Information

  • Download (HTTP): https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz

  • Download MD5 sum: 35b5a3d0254c1c59be9736373d429db7

  • Download size: 17 MB

  • Estimated disk space required: 187 MB (add 27 MB for tests)

  • Estimated build time: 0.5 SBU (using parallelism=4; add 2.1 SBU for tests, including rebuilding)

Python 3 Dependencies

Recommended

Optional

BlueZ-5.54, GDB-9.2 (required for some tests), Valgrind-3.16.1, and libmpdec

Optional (For Additional Modules)

Berkeley DB-5.3.28 and Tk-8.6.10

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/Python3

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 &&
make

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/libpython3.8.so &&
chmod -v 755 /usr/lib/libpython3.so

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 tests, 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. The test SBU highly depends on the speed of the internet connection. The test_sqlite test is known to fail.

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.

--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.

--enable-optimization: Use this switch if you want to enable expensive optimizations (i.e. Profile Guided Optimizations). This adds around 20 SBU, but can slightly speed up some uses, such as using Sphinx for creating documentation, or use of Python3 scripts.

--with-lto: This optional switch enables thick Link Time Optimization. Unusually, it creates a much larger /usr/lib/python3.8/config-3.8-<arch>-linux-gnu/libpython3.8.a with a small increase in the time to compile Python. Run-time results do not appear to show any benefit from doing this.

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.8.5 /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

Contents

Installed Programs: 2to3 (symlink) and 2to3-3.8, easy_install (symlink) and easy_install-3.8, idle3 (symlink) and idle3.8, pip3 (symlink) and pip3.8, pydoc3 (symlink) and pydoc3.8, python3 (symlink); python3.8, and python3-config (symlink) and python3.8-config
Installed Libraries: libpython3.8.so and libpython3.so
Installed Directories: /usr/include/python3.8, /usr/lib/python3.8, and /usr/share/doc/python-3.8.5

Short Descriptions

easy_install

is a frontend to pip3 to make it easier to configure python modules through the PIP package manager.

idle3

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.

pydoc3

is the Python documentation tool.

python3

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

python3.8

is a version-specific name for the python program.

Last updated on 2020-08-17 12:49:57 -0700