-
Notifications
You must be signed in to change notification settings - Fork 56
Building Python 3.x
Below versions of Python are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.8, 8.10) have
3.12.3
- RHEL (9.2, 9.4) have
3.12.1
- SLES 15 SP5 has
3.12.3
- SLES 15 SP6 has
3.12.4
- Ubuntu 20.04 has
3.9.5
- Ubuntu 22.04 has
3.11.0
- Ubuntu 24.04 has
3.12.3
The instructions provided below specify the steps to build Python version 3.13.0 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.10, 9.2, 9.4)
- SLES (15 SP5, 15 SP6)
- Ubuntu (20.04, 22.04, 24.04)
General Notes:
- When following the steps below please use a standard permission user unless otherwise specified.
- A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build Python using manual steps, go to STEP 1.2.
Use the following commands to build Python using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Python3/3.13.0/build_python3.sh
# Build Python
bash build_python3.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 1.7. In case of error, check logs
for more details or go to STEP 1.2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (8.8, 8.10, 9.2, 9.4)
sudo yum install -y bzip2-devel gcc gcc-c++ gdbm-devel libdb-devel libffi-devel libuuid-devel make ncurses-devel openssl-devel tar tk-devel wget xz zlib-devel diffutils xz-devel patch
-
SLES (15 SP5, 15 SP6)
sudo zypper install -y gawk gcc gcc-c++ gdbm-devel libbz2-devel libdb-4_8-devel libffi-devel libnsl-devel libopenssl-devel libuuid-devel make ncurses-devel tar tk-devel wget xz-devel zlib-devel gzip
-
Ubuntu (20.04, 22.04, 24.04)
sudo apt-get update sudo apt-get install -y gcc g++ libbz2-dev libdb-dev libffi-dev libgdbm-dev liblzma-dev libncurses-dev libreadline-dev libsqlite3-dev libssl-dev make tar tk-dev uuid-dev wget xz-utils zlib1g-dev patch
cd $SOURCE_ROOT
wget https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz
tar -xzf Python-3.13.0.tgz
Skipping the prefix will result in installing Python in default location /usr/local
.
cd $SOURCE_ROOT/Python-3.13.0
./configure --prefix=<build-location>
For instance,
cd $SOURCE_ROOT/Python-3.13.0
./configure --prefix=/usr/local
cd $SOURCE_ROOT/Python-3.13.0
make
sudo make install
python3 -V
The output should be:
Python 3.13.0
cd $SOURCE_ROOT/Python-3.13.0
Run the test suites
make test
cd $SOURCE_ROOT/Python-3.13.0
make test TESTOPTS="-v test_<suite_name>"
For instance,
cd $SOURCE_ROOT/Python-3.13.0
make test TESTOPTS="-v test_pty"
Note: Following python test case has been observed to fail intermittently. It should pass on rerun.
test_pty
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.