Ubuntu should already have Python 2.7 installed. You can confirm this by running this command:
python --version
If you see Python 2.7.xx (where xx is the patch version and can be any number), you're ready to install the EMSDK. If you get an error saying the python command wasn't found or you see Python 3.x.xx, I recommend you install pyenv, a Python version manager. Before installing pyenv, check if you have curl installed. You can do this by running the following command:
curl --version
If you see a version number and other information, curl is installed. If not, you can install curl by running the following command:
sudo apt-get install curl
Once the curl installation is complete, run this command to install pyenv:
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
After installing and configuring pyenv, run this command to install Python 2.7:
pyenv install 2.7.15
If you encounter build issues, navigate to the Common build problems page at https://github.com/pyenv/pyenv/wiki/common-build-problems. After the installation is complete, run this command:
pyenv global 2.7.15
To ensure you're using the correct version of Python, run this command:
python --version
You should see Python 2.7.xx, where xx is the patch version (I was seeing 2.7.10, which will work fine).