How to install python 3.7 on macbook M1 ?

This is what you get when you try to install python 3.7 from brew on M1.

➜ brew install python@3.7
python@3.7: The x86_64 architecture is required for this software.
Error: An unsatisfied requirement failed this build.

Problem is python 3.7 from homebrew only work on x86.

I have Rosetta2, Can I use brew x86 to install python 3.7 ?

Answer is YES, start from install brew x86 version aka ibrew

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Add alias to rc file

alias ibrew="arch -x86_64 /usr/local/bin/brew"

Install python 3.7 on M1 🎉🎉🎉

ibrew install python@3.7

Now you can choose between brew when you want to install ARM app or ibrew when you want to install x86 app. Happy coding 😄

References

90s programmer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store