Ideally you can restore whatever you‘ve deleted from a backup.

If you removed the standard Python installation of macOS, boot into the Recovery Partition (if any) and reinstall macOS from there. This should leave your other files intact, it‘s not a bad idea to do a backup before nevertheless.

Alternatively, you can through Homebrew.

Once Homebrew is installed, run:

brew install python@2

That won't likely install the same 2.7 revision you were using.

If you need an exact match, or don't/can't use Homebrew; I'd build it from source (if so, comment for further instruction).

Python 2 is end of life by January 1st 2020. Please don’t use it unless you are sure you are using an OS default.


If I am not in mistake, as of June 2020 macOS 10.15.4 (i.e., not fully up to date) is still at Python 2.7 (2.7.16).

If you are at 10.15.5 or later you are welcome to comment your mileage.


brew uninstall --ignore-dependencies python3

Then:

brew install python3

and done:

python3