10

I would like to install a few packages from a github project and one of the dependencies is python@2.

Prior to Jan 1 2020, it was possible to install python@2 using Homebrew:

$ brew install python@2

However, Python 2 support has ended from Homebrew. Is there anyway to install python@2 on a Mac now that Python 2 support has ended?

Until the code in this project is ported to Python 3, unfortunately I'm stuck with getting it to work with Python 2 (and dependencies which use Python 2), which is the reason I would like to install python@2 as a temporary solution.

NM_
  • 1,887
  • 3
  • 12
  • 27
  • I know that on linuux I would download and build from sources. But I don't know if this possible on mac. – miszcz2137 Mar 12 '20 at 08:56
  • Does this answer your question? [MacOS: How to downgrade homebrew Python?](https://stackoverflow.com/questions/44217507/macos-how-to-downgrade-homebrew-python) – Pavel Vergeev Mar 12 '20 at 09:11
  • @PavelVergeev Thank you for the suggestion, but unfortunately I'm not able to install `pyenv` on Catalina. The other issue is actually being able to find the source for `python@2`. – NM_ Mar 14 '20 at 21:10

1 Answers1

9

I was able to find the exact same question -- Brew - reinstalling python@2. Unfortunately I can't raise the duplicate flag again so I'll duplicate the answer:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/86a44a0a552c673a05f11018459c9f5faae3becc/Formula/python@2.rb
Pavel Vergeev
  • 3,060
  • 1
  • 31
  • 39
  • 8
    This answer no longer works. A working option one can found in this answer... https://stackoverflow.com/questions/63844926/mac-install-python3-6-with-brew – agascon Oct 19 '20 at 09:03
  • 4
    Error: Installation of python@2 from a GitHub commit URL is unsupported! `brew extract python@2` to a stable tap on GitHub instead. – Muhammad Shauket May 17 '22 at 03:06