I also using Debian 11, and this is how I always install Python from source:
wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0b3.tgz
tar xvzf Python-3.11.0b3.tgz
cd Python-3.11.0b3.tgz
sudo apt install libssl-dev zlib1g-dev libbz2-dev liblzma-dev libffi-dev tcl-dev libgdbm-dev libsqlite3-dev libreadline-dev tk tk-dev libmpdec-dev
./configure --enable-loadable-sqlite-extensions --enable-shared --with-lto --enable-optimizations --with-system-expat --with-system-ffi --with-computed-gotos --with-system-libmpdec --enable-ipv6 CC=x86_64-linux-gnu-gcc
make
sudo make altinstallpython3.11: error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory
Alternatively a tool like pyenv makes this much easier.
>>> Install dependencies with apt (a few popular pages on google for this).
I don't know what this means :) So let's go to step 2:
>>> Download tarball.
Me tries this:
wget 'https://www.python.org/ftp/python/3.11.0/Python-3.11.0a1.tgz'
>>> Configure.What does this mean?
>>> make altinstall
I guess I somehow need to untar the tar thing first?
Me tries this:
tar -xf Python-3.11.0a1.tgz
Hurray, I have a directory :)Let's cd into it:
cd Python-3.11.0a1
And now the make altinstall? make altinstall
Gives me: bash: make: command not found
Hm... apt install make
make altinstall
Gives me: make: *** No rule to make target 'altinstall'. Stop.
Hm... yeah, looks like it is beyond my paygrade.> What does this mean?
It means to run the “./configure” script first, which is normally present in the unpacked tar file. Also, on Debian, to compile programs, you usually first have to install the “build-essential” package.
> I don't know what this means :) So let's go to step 2:
`apt-get build-dep python3`
pyenv install 3.11.0b3