You can get any Python release, including the last Python 2, from the official download site:
https://www.python.org/downloads/release/python-2718/ → macOS 64-bit installer
Answer from mkrieger1 on Stack OverflowYou can get any Python release, including the last Python 2, from the official download site:
https://www.python.org/downloads/release/python-2718/ → macOS 64-bit installer
If, like me, you need it for development you should use PyEnv:
Here's a great tutorial: https://dev.to/jordicuevas/how-to-install-python2-in-a-macbook-m1-with-brew-bhi
TL;DR:
brew install pyenv
pyenv install 2.7.18
export PATH="$(pyenv root)/shims:${PATH}"
echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc
pyenv init
(Follow instructions provided. I had to add to ~/.zprofile and ~/.zshrc.)
Make sure you load the changes by running source ~/.zprofile and source ~/.zshrc.
pyenv shell 2.7.18
Now, the python command should target Python 2 in the shell/Terminal.
macos - How to install System Python 2.7 on a Mac - Stack Overflow
macos - What is the best way to install python 2 on OS X? - Stack Overflow
how to open python 2.7 on mac (using terminal)
Installing Python 2.7 in Frameworks Folde… - Apple Community
I recommend installing packages on OS X using Homebrew as it keeps everything you install in one place. Allowing you to upgrade or uninstall easily and not needing to remember how or where you installed it.
Once it is installed you simply type brew install python in your terminal. This will install Python 2.7.10 and it will be available at /usr/local/bin/python.
The only supported way to restore the system Python framework on macOS is to reinstall the operating system. It is treated as a component of the core operating system, so there is no way to selectively reinstall it.
Note from https://docs.brew.sh/Homebrew-and-Python: "Homebrew provides formulae to brew Python 3.y. A python@2 formula was provided until the end of 2019, at which point it was removed due to the Python 2 deprecation."
I use brew to install all my libraries/compilers/interpreters.
To install python try this:
brew install python
Then add Python's binaries directory to your $PATH in your ~/.profile:
export PATH=`brew --prefix python`/bin:$PATH
I'd recommend you to install pip, virtualenv and virtualenvwrapper to have better control over your environment too.
Have you tried ActivePython?
It includes a package manager (PyPM) that, by default, installs into your home directory (eg: ~/Library/Python/2.7). Main scripts get symlinked in /usr/local/bin; use the included pythonselect to set the active Python version.
You don't have to bother installing .dmg packages, as PyPM is a binary package manager ... therefore you can install non-pure Python packages like NumPy without having to compile things yourself.
ActivePython can use Apple's Tcl/Tk or, if installed, ActiveTcl.
A "simplest, most general approach" in your documentation could be:
- Install ActivePython 2.7
- Open Terminal and type
pypm-2.7 install matplotlib ipython