mkdir /opt/python3.12
cd /opt/python3.12
apt -y install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git
wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
tar -xf Python-3.12.0.tgz
rm Python-3.12.0.tgz
cd Python-3.12.0/
./configure --enable-optimizations
make -j 8
make altinstall
python3.12 --version
python3.12 -m pip install --upgrade pip
python3.12 -m pip install ipykernel
# finally installing ipython kernel
python3.12 -m ipykernel install --sys-prefix --name <UNIQUE_KERNEL_NAME> --display-name "<KERNEL DISPLAY NAME>" |