# Python 3.10.17 (released 2025-04-08)
# =============
# See the main Python HOWTO for general information and then continue here
# for information specific to 3.10.x releases
# If you're about to upgrade from 3.9.x to 3.10.x, read this:
# What's New In Python 3.10
# for info about changes between the two versions. For more info read
# Misc/NEWS.
# Get the source tarball
cd
test -f installed/Python-3.10.17.tar.xz && mv installed/Python-3.10.17.tar.xz .
test ! -f Python-3.10.17.tar.xz &&
wget https://www.python.org/ftp/python/3.10.17/Python-3.10.17.tar.xz
# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "Python-3.*" -exec rm -r {} \;
tar xJvf ~/Python-3.10.17.tar.xz
cd Python-3.10.17
test $UID = 0 && chown -R root:root .
# I used to apply a patch to change various things from /lib/ to /lib64/
# which configure's --libdir was not handling. Now there is a
# --with-platlibdir=lib64 that will help that, but even with that, you
# will still end up with a /usr/lib/python3.10/site-packages/
# See Slackware64 source for the python package for patches if
# needed.
## Configure the build
# If you somehow don't need pip, leave off --with-ensurepip=install
# You could just install it later, but every way I tried to do it a while
# back with 2.x, I'd get stuck with a dependency loop between the get-pip.py
# script needing urllib3, not having it, that requires something else, ...
# If you want to enable optimizations, use ... --enable-optimizations
# If you have source-installed OpenSSL < 1.1.0 with the default prefix of
# /usr/local/ssl and are 64-bit, you may need to use this at the beginning of
# configure:
# LDFLAGS=-L/usr/local/ssl/lib64
# If you are 64-bit:
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr \
--libdir=/usr/lib64 \
--mandir=/usr/man \
--enable-shared \
--without-static-libpython \
--with-platlibdir=lib64 \
--with-ensurepip=install \
--with-system-expat \
--enable-optimizations
# If you are not 64-bit, no need to add anything for /usr/lib:
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr \
--mandir=/usr/man \
--enable-shared \
--without-static-libpython \
--with-ensurepip=install \
--with-system-expat \
--enable-optimizations
# Build it
make -j $(nproc)
# Test the build (some tests may require su/sudo)
make test
# Become root to clean up old files and to install it
su
# Remove the Slackware packages, if there are any installed:
test -x /sbin/removepkg &&
/sbin/removepkg python python3 python-demo python-pillow python-setuptools \
python-tools
## Install the new version
# Use 'make install' will give you 'python3' and 'python3.10' but not
# update 'python'. Remove any existing ones, then create a symlink below
# if necessary. ...or just get used to running 'python3' and 'pip3'.
( cd /usr/bin ; rm -f python python-config pip )
# If you use 'make altinstall' instead, that will only install them as
# 'pythonX.X' so you can upgrade older versions without overwriting
# whatever version python3, python3-config, pip3 are now.
# Install it also making python3, python3-config, pip3 version 3.10
make install
ldconfig
# Right now if you run 'python3' or 'python3.10' you will get Python 3.10.17
# Right now if you run 'pip3' or 'pip3.10' you will get pip 3.10.17
# If you want to be able to run python, python-config, pip, etc. with
# no version (python3.10) and not even 3 (python3), create symlinks.
# Some of these may be fine already, but some may not, so just update
# all of them. Rather than testing symlink/file, seeing what the
# shebang line points to, just remove them and then create a symlink.
( cd /usr/bin
rm -f 2to3 pip pydoc python python-config
ln -s 2to3-3.10 2to3
ln -s pydoc3 pydoc
ln -s python3 python
ln -s python3-config python-config
ln -s pip3 pip )
# You should have a /usr/include/python3.10/, and more if you have other
# versions of Python installed
# And you should have a /usr/lib*/libpython3.10.so.1
# and a /usr/lib*/libpython3.10.so symlink pointing to libpython3.10.so.1
# and a /usr/lib*/libpython3.so
# And in /usr/lib*/pkgconfig/ you should have:
# python-3.10-embed.pc
# python3-embed.pc symlink pointing to python-3.10.embed.pc
# python-3.10.pc
# python3.pc symlink pointing to python-3.10.pc
# And you should have /usr/lib*/python3.10/
# And in /usr/man/man1/ you should have:
# python3.10.1 ('man python3.10')
# python3.1 symlink pointing to python3.10.1 ('man python3')
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# If you used 'make altinstall' and already had a previous version of Python
# installed, then the python and python-config symlinks should still point
# to the previous version.
# If you used the regular 'make install' and now you want 'python' and
# 'python3' to run an older one, you will need to create symlinks pointing
# to that one.
# If you want to upgrade pip, with pip, run the following:
/usr/bin/python3.10 -m pip install --upgrade pip
# For pip usage use 'pip3 --help' or 'pip3.10 install --help'
pip3.10 --version
pip3 --version
pip --version
# Become yourself again
exit
# Keep the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/Python-3.10.*.tgz installed/Python-3.10.*.tar.*
mv Python-3.10.17.tar.xz installed/