8.50. Python-3.10.2

#### Linux From Scratch - Version 11.1-rc1

### Chapter 8. Installing Basic System Software

- Prev

  Libffi-3.4.2

- Next

  Ninja-1.10.2

- Up
- Home

# 8.50. Python-3.10.2

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

Approximate build time: 4.3 SBU
Required disk space: 275 MB

## 8.50.1. Installation of Python 3

Prepare Python for compilation:

    ./configure --prefix=/usr        \
                --enable-shared      \
                --with-system-expat  \
                --with-system-ffi    \
                --with-ensurepip=yes \
                --enable-optimizations

The meaning of the configure options:

`--with-system-expat`

  This switch enables linking against 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.

`--enable-optimizations`

  This switch enables stable, but expensive, optimizations.

Compile the package:

    make

Running the tests at this point is not recommended. The tests are known to hang indefinitely in the partial LFS environment. If desired, the tests can be rerun at the end of this chapter or when Python 3 is reinstalled in BLFS. To run the tests anyway, issue make test.

Install the package:

    make install

If desired, install the preformatted documentation:

    install -v -dm755 /usr/share/doc/python-3.10.2/html

    tar --strip-components=1  \
        --no-same-owner       \
        --no-same-permissions \
        -C /usr/share/doc/python-3.10.2/html \
        -xvf ../python-3.10.2-docs-html.tar.bz2

The meaning of the documentation install commands:

`--no-same-owner` and `--no-same-permissions`

  Ensure the installed files have the correct ownership and permissions. Without these options, using tar will install the package files with the upstream creator's values.

## 8.50.2. Contents of Python 3

Installed Programs: 2to3, idle3, pip3, pydoc3, python3, and python3-config
Installed Library: libpython3.10.so and libpython3.so
Installed Directories: /usr/include/python3.10, /usr/lib/python3, and /usr/share/doc/python-3.10.2

### Short Descriptions

2to3 | is a Python program that reads Python 2.x source code and applies a series of fixes to transform it into valid Python 3.x code
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
pip3 | The package installer for Python. You can use pip to install packages from Python Package Index and other indexes
pydoc3 | is the Python documentation tool
python3 | is an interpreted, interactive, object-oriented programming language

- Prev

  Libffi-3.4.2

- Next

  Ninja-1.10.2

- Up
- Home