How to install Python Specific version (3.8, 3.9 or 3.10) using Brew


Installed different versions of Python3 using brew

If you want to install a specific version of Python using brew you can use brew install python followed by a @ (at sign) and the version number,

Installing Python 3.8

% brew install python@3.8 

Python has been installed as
  /opt/homebrew/bin/python3.8

Installing Python 3.9

% brew install python@3.9 

Python has been installed as
  /opt/homebrew/bin/python3.9

Installing Python 3.10

% brew install python@3.10 

Python has been installed as
  /opt/homebrew/bin/python3

Make sure to note the path and you can add it to your PATH in .zhrc file to make it permanently accessible.

% ls -F1 /opt/homebrew/bin/python*
/opt/homebrew/bin/python3@
/opt/homebrew/bin/python3-config@
/opt/homebrew/bin/python3.10@
/opt/homebrew/bin/python3.10-config@
/opt/homebrew/bin/python3.8@
/opt/homebrew/bin/python3.8-config@
/opt/homebrew/bin/python3.9@
/opt/homebrew/bin/python3.9-config@

As you can see I have installed all 3 versions of Python using brew.

-


Have Questions? Post them here!


Top Hashtags: