How to install Python 2.7.x version on macOS Ventura/Sonoma

If you have a new Mac/Macbook with macOS Ventura 13.x or Sonoma 14.x, then you will notice that Python 2.7 or any 2.x version is not pre-installed on it. You will need to get it installed by yourself.

To do so, we can make use of the Homebrew package manager.

If you do not have Brew installed, please get it installed by following the article -

Step 1: Install pyenv using Homebrew

The first step you will do is install the Python version management tool.

brew install pyenv
Install Python Env using Brew

Step 2: Install Python 2.x using pyenv

Once this is complete, we can install the Python 2.7.18 version using pyenv command.

pyenv install 2.7.18
Installing Python 2.7.18 on macOS Sonoma

Step 3: Add Python 2.7.x PATH to ZSH Profile

Finally, to python command work, you will need to add the PATH to the installed Python 2.7.x version to the .zshrc file.

export PATH=$PATH:/Users/code2care/.pyenv/versions/2.7.18

This is not an AI-generated article but is demonstrated by a human on an M1 Mac running macOS Sonoma 14.0.

Please support independent contributors like Code2care by donating a coffee.

Buy me a coffee!

Buy Code2care a Coffee!

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:

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