Install Python Mac Catalina

Recently I wrote a post entitled Installing the latest version of Python on Mac OS Catalina and overriding the old default pre-installed version about installing Python 3.7.7 on Mac OS Catalina with Homebrew. Python 3.7.7 was the latest version of Python that one could install.

  1. Install Python Mac Catalina Operating System
  2. Install Python 2.7 Mac Catalina

I'm attempting to get a working version of python3 installed on a mac running Catalina (10.15.7).Calling python3 from the terminal ultimately errors with a software. Pip is a tool for easily installing and managing Python packages, that is recommended over easyinstall. It is superior to easyinstall in several ways, and is actively maintained. $ pip2 -V # pip pointing to the Homebrew installed Python 2 interpreter $ pip -V # pip pointing to the Homebrew installed Python 3 interpreter (if installed). Get code examples like'install python macos catalina'. Write more code and save time using our ready-made code examples.

May 29th, 2020

  • Link toInstalling the latest version of Python on Mac OS Catalina and overriding the old default pre-installed versionpodcast on anchorfm

I finally did it. I successfully installed Python version 3.7.7 viaHomebrew on my Maclaptop with OS Catalinainstalled.

For those of you that still might be trying to figure outhow todo this, I will walk you through.

The reason why I was eager to make sure that I had the latest versioninstalled was because I am working on publishing (open-source)teaching-relateddocumentation on Read The Docs, and I need to havePythoninstalled in order to be able to install the programsnecessary to publishthere.

The default2.7.17 version of Python was retired this pastJanuary 2020. I had tried back then to replace it with Python 3+,but was unsuccessful at the time. The following is what I did today:

First I updated Homebrew. Yes, I used Homebrew to (re)installPython. It’s really easy. It’s just a matter of putting the pieces of thepuzzle together correctly!

I ran the command

To updateHomebrew. Then I ran the command

To (re)install Python. Then I ran

To see which version of Python my Mac laptop was recognizing. Itstill recognized only Python 2.7.17. So I ran the followingcommand:

It told me the path to my newly installedPython 3.7.7. I had tochange the path to Python in order for my Mac to recognize thenewly installed version. This is what the command brew info python returned tome in Terminal:

So I had to add the following at the bottom of my .zshrc fileto update the path to my newly installed version of Python viaHomebrew:

Then I made sure to quitTerminal and go back in so that the pathwould actually be updated in a newTerminal windowinstance.

Then I checked what version of Python was recognized now with

Install python mac catalina download

And this is what was returned:

Success! It’s as easy as that.

And BTW, if you don’t know how to access your .zshrc file in Catalina,you simply execute the following command:

And your file will open in a new window. Then you can paste

At the bottom of the file.

I will be embedding this episode of Plugging in The Holes along with atranscript in the form of a post oninterglobalmedianetwork.com for yourhearing and reading pleasure. Bye for now!

Related Resources

Categorized under:osxpython3catalina

Created by Maria D. Campbell who lives and works in New York City building useful things.You should follow her on Twitter. She also has a developer blogmariadcampbell.comyou may want to check out!

Note

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

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

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.

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.

Note

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

Note

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 python@2 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¶

Mac

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.

Install Python Mac Catalina Operating System

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

Install Python 2.7 Mac Catalina

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