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.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap