In my shell, I create a new python 3.9.19 ipykernel environment:
$ ~/local/python/3.9/bin/python3 -m ipykernel install --user --name test_3dot9
Installed kernelspec test_3dot9 in /home/user/.local/share/jupyter/kernels/test_3dot9
$ jupyter kernelspec list
Available kernels:
test_3dot9 /home/user/.local/share/jupyter/kernels/test_3dot9
python3 /home/user/local/python/3.12/share/jupyter/kernels/python3
Then I open a console with the test_3dot9 kernel in web ui of jupyterlab.
Python 3.9.19 (main, Apr 29 2024, 15:50:25)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.18.1 -- An enhanced Interactive Python. Type '?' for help.
[1] !python --version
Python 3.12.3
Why?