Actually, there is a much easier way to install python 3.11 on Amazon Cloud9 if you are using Amazon Linux 2023.
We can simply run this command to install it:
sudo dnf install python3.11 -y
And to install pip for python 3.11
sudo dnf install python3.11-pip -y
You can refer to the below for detailed info https://plainenglish.io/community/how-to-install-python-3-11-with-pip-on-amazon-linux-2023-9ab2ed