If you don't have the minimum required version of Python3 installed, here is an example procedure of installing it from source to an alternative directory on CentOS 7.
Install system libraries.
sudo yum -y install openssl-devel readline-devel
Download and unpack Python.
PYTHON_VERSION=3.11.10
INSTALL_PREFIX=/opt/python3
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
tar -xvf Python-${PYTHON_VERSION}.tgz
cd Python-${PYTHON_VERSION}
Edit Modules/Setup.dist to enable SSL.
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib64 -lssl -lcrypto
Configure, compile and install, --enable-optimizations is an optional parameter that, supposedly, makes Python code run 10% faster on average (also greatly increases the time needed to install Python itself).
./configure --prefix=${INSTALL_PREFIX} --enable-optimizations
make -j 4
sudo make install
Add /opt/python3/bin to the PATH.
PowerDNS needs to be built with Remote Backend support, example installation from source on CentOS 7.
# install system libraries
sudo yum -y install gcc-c++ boost boost-devel
PDNS_VERSION=4.0.3
# download and build pdns
wget -P /tmp/ https://downloads.powerdns.com/releases/pdns-${PDNS_VERSION}.tar.bz2
tar -xvf /tmp/pdns-${PDNS_VERSION}.tar.bz2 -C /tmp
cd /tmp/pdns-${PDNS_VERSION}
./configure --with-modules="remote" && make -j 4
sudo make install
# install pdns systemd file
sudo cp pdns/pdns.service.in /etc/systemd/system/multi-user.target.wants/pdns.service
# edit pdns.service and set @sbindir@ to the path to pdns_server binary
# additionally I had to change Type from notify to simple, e.g.:
# [Service]
# Type=simple
# ExecStart=/usr/local/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --write-pid=no
# clean up
sudo rm -rf /tmp/pdns-${PDNS_VERSION}.tar.bz2 /tmp/pdns-${PDNS_VERSION}