I'm creating an AMI of Ubuntu 20.04 (Focal Fossa), and I want the default Python version to be 3.6.
I installed Python 3.6, also the right pip, and then set the alternative like so:
update-alternatives --install \
/usr/bin/python3 \
python3 \
/usr/bin/python3.6 \
10
But then I'm running into many issues related to CPython packages, such as python3-apt (apt_pkg, apt_inst), netifaces, and probably many more I didn't catch yet.
They are all located on /usr/lib/python3/dist-packages and the package names are in this format:
{name}.cpython-38-x86_64-linux-gnu.so
Which makes sense, since the default Python version of Ubuntu 20.04 is Python 3.8.
The immediate solution from googling is linking the name like so:
ln -s {name}.cpython-38-x86_64-linux-gnu.so {name}.so
I.e.:
ln -s apt_pkg.cpython-38-x86_64-linux-gnu.so apt_pkg.so
ln -s netifaces.cpython-38-x86_64-linux-gnu.so netifaces.so
I tried reinstalling the relevant packages (apt install --reinstall python3-apt) when the default Python version is 3.6, but it didn't work, and this solution of linking the *.so files is not scalable!
Is there a way to make Python 3.6 work with the system's default CPython packages?