Python Macos Install

  1. Python Mac Install Location
  2. Python Macos Installer
  3. Python Mac Install Requests
  4. Python Mac Install Package
  5. Python Mac Os Installation
  6. Python Macos Install Pip
  • Python is a flexible programming language that gives you a lot of power in MacOS. We'll look at four methods of setting up Python on MacOS. Using pre-packaged system Python 2. Using the official installer 3. Using Homebrew to install 4. Compiling Python from source.
  • At this point in my Python career, I am new to this, but I am willing to try pretty much anything to get this up and running. If it helps I am officially running, Mac OS X 10.7.5, and I do have MAMP installed (is that an issue?) Also, the other day when I was trying all of this for the first time I installed (reinstalled?).


I am new in macOS, and I have a little problem with installing python. I have downloaded from python webpage current version 3.9, and installed it. Now if I open command line, and write command. Python3 -V get result. Python 3.8.2 If I run. Sudo python3 -V I get. Run the installer package. Launch Python from the terminal. 00:00 Installing on macOS. Here’s the Mac desktop. Most Macs come with Python installed, but it’s normally an older version. The first job is for you to check which versions you have installed. 00:14 Command + Space allows you to search for programs, so you can type.

Check out our guide for installing Python 3 on OS X.

Mac OS X comes with Python 2.7 out of the box.

Python Mac Install Location

You do not need to install or configure anything else to use Python. Having saidthat, I would strongly recommend that you install the tools and librariesdescribed in the next section before you start building Python applications forreal-world use. In particular, you should always install Setuptools, as it makesit much easier for you to install and manage other third-party Python libraries.


Python Macos Installer


The version of Python that ships with OS X is great for learning, but it’s notgood for development. The version shipped with OS X may be out of date from theofficial current Python release,which is considered the stable production version.

Doing it Right¶

Let’s install a real version of Python.

Before installing Python, you’ll need to install a C compiler. The fastest wayis to install the Xcode Command Line Tools by runningxcode-select--install. You can also download the full version ofXcode from the Mac App Store, or theminimal but unofficialOSX-GCC-Installerpackage.


If you already have Xcode installed, do not install OSX-GCC-Installer.In combination, the software can cause issues that are difficult todiagnose.


If you perform a fresh install of Xcode, you will also need to add thecommandline tools by running xcode-select--install on the terminal.

While OS X comes with a large number of Unix utilities, those familiar withLinux systems will notice one key component missing: a decent package manager.Homebrew fills this void.

To install Homebrew, open Terminal oryour favorite OS X terminal emulator and run

The script will explain what changes it will make and prompt you before theinstallation begins.Once you’ve installed Homebrew, insert the Homebrew directory at the topof your PATH environment variable. You can do this by adding the followingline at the bottom of your ~/.profile file

Now, we can install Python 2.7:

Because [email protected] is a “keg”, we need to update our PATH again, to point at our new installation:

Homebrew names the executable python2 so that you can still run the system Python via the executable python.

Setuptools & Pip¶

Homebrew installs Setuptools and pip for you.

Setuptools enables you to download and install any compliant Pythonsoftware over a network (usually the Internet) with a single command(easy_install). It also enables you to add this network installationcapability to your own Python software with very little work.

pip is a tool for easily installing and managing Python packages,that is recommended over easy_install. It is superior to easy_installin several ways,and is actively maintained.

Virtual Environments¶

A Virtual Environment (commonly referred to as a ‘virtualenv’) is a tool to keep the dependencies required by different projectsin separate places, by creating virtual Python environments for them. It solves the“Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keepsyour global site-packages directory clean and manageable.

For example, you can work on a project which requires Django 1.10 while alsomaintaining a project which requires Django 1.8.

To start using this and see more information: Virtual Environments docs.

This page is a remixed version of another guide,which is available under the same license.


Python is a flexible programming language that gives you a lot of power in MacOS.We'll look at four methods of setting up Python on MacOS.

  1. Using pre-packaged system Python
  2. Using the official installer
  3. Using Homebrew to install
  4. Compiling Python from source

Python installation methods


Let's review some of the different options for installing Python on MacOS.

Use system Python (Not recommended)

The latest version of MacOS comes with Python 3 but there are a number of reasons I recommend not using it:

  • It will be older version than latest version
  • It will not come with the Tk gui package
  • It will not have the IDLE editor
  • The system uses the packages, so you will have to be careful what you install and use sudo, or do user-only package installs for pip, or create a venv - nothing wrong with creating a venv and adding it to your .zshrc to use it all the time

Official installer (Recommended for everyone)

The official Python installer is the easiest and also provides the latest version with all of the goodies like IDLE and Tkinter. To get the installer, go to and download the version for your system. You can also find the documentation there.

  • Will come with documentation, IDLE editor, and Python Launcher applications to your app menu
  • The Python launcher can be used to execute Python (.py/.pyw) scripts from the Finder
  • Installs to a path similar to /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
  • You can run it using /usr/local/bin/python3

If you need to set up your PATH, you can add a line like this to your .zshrc:

Using Homebrew (Recommended for advanced)

You can use the Homebrew package manager to install Python. Install with the following command:

This installs to: /usr/local/Cellar/python which the interpreter symlinked at /usr/local/bin/python3 and idle symlinked at /usr/local/bin/idle3.

Compiling Python from source code (Recommended for advanced)

Compiling Python from source is a lot more work but can get you the latest development version of Python. You will have to take many additional things in to consideration like which extensions to include and what options to set. It can be a good exercise in learning. I have a dedicated tutorial about Building Python from Source.

Testing install

You can run a few commands to help identify the installed Python versions and which onewill be run by default when only running python3 without the full absolute path.

Notes about multiple installations

It is possible to have multiple versions of Python installed. In addition to the system Python 2 and Python 3, you can also have Python 3 installed from the official installer as well as Homebrew's Python 3 all at once. It can get confusing and you may accidently install a package to one version of Python while your IDE is using a different version.

Python Mac Install Requests

They can all co-exist if you know what you are doing, but I recommend choosing either the Homebrew method or the official installer and not both. I prefer the official installer.

You can use where python3 or where idle3 to see which executables you have available in your path.

The /usr/bin/python3 is the system Python, and the one you want to avoid using. Homebrew and the official Python installer will both symlink executables to /usr/local/bin/python3 depending on which one was installed last.

The system Python (in /usr/bin/) may end up in your PATH environment variable before your installed version (in /usr/local/bin/). This is one reason I recommend creating a virtual environment and explicitly activate it (see the next section on virtual environment).

If you want to modify your path so one Python has precedence over the other, you can update your PATH in your .zshrc/.bashrc file to put the preferred directory before the rest of your path:

Recommended: Create a virtual environment

Due to the confusion mentioned in the previous section,it can be very helpful to create a virtual environment.

Python Mac Install Package

To learn more about virtual environments see my Virtual Environments Tutorial.

Here is a simple example of how to create a virtual environment.

Python Mac Os Installation

Then to activate the virtual environment, you could run the following command.You can also add the line to your $HOME/.zshrc file to load the virtual environment automatically on shell load.

Python Macos Install Pip


After reading this guide, you should have a good understanding of what methods are available to get Python 3 on your MacOS system as well as how to manage multiple versions.