Install Python Mac Catalina

  

I'm still working on getting pyenv in my bloodstream. It seems like totally the right tool for having different versions of Python available on macOS that don't suddenly break when you run brew upgrade periodically. But every thing I tried failed with an error similar to this:

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).

I read through the Troubleshooting FAQ and the 'Common build problems' documentation. xcode was up to date and I had all the related brew packages upgraded. Nothing seemed to work.

  1. In this video how to install Python 3.8 in a Mac OS X or MacOS, both macOS Catalina. As the Python website says, 'Python 3.x is the present and future of th.
  2. The macOS 10.15 SDK provides support for developing apps for Macs running macOS Catalina 10.15. The SDK comes bundled with Xcode 11 available from the Mac App Store. For information on the compatibility requirements for Xcode 11, see Xcode 11 Release Notes.

Until I saw this comment on an open pyenv issue: 'Unable to install any Python version on MacOS'

All I had to do was replace the 10.14 for 10.15 and now it finally worked here on Catalina 10.15. So, the magical line was this:

Hopefully, by blogging about it you'll find this from Googling and I'll remember the next time I need it because it did eat 2 hours of precious evening coding time.

Related posts

Install Python Mac Catalina Download

Previous:
redirect-chain - Getting a comfortable insight input URL redirects history14 February 2020
Next:
How to install Node 12 on Ubuntu (Eoan Ermine) 19.1008 April 2020
Install python 2.7 mac catalina
Related by category:
How much faster is Redis at storing a blob of JSON compared to PostgreSQL?28 September 2019Python
Best practice with retries with requests19 April 2017Python
Fastest way to find out if a file exists in S3 (with boto3)16 June 2017Python
Interesting float/int casting in Python25 April 2006Python
Fastest way to unzip a zip file in Python31 January 2018Python

Posted on October 4, 2016 by Paul

Updated 15 June 2021

In this article, I will show you how to install Python with NumPy, SciPy and Matplotlib on macOS Big Sur.

I assume you are on an Intel based Mac. If you have an arm64 Mac, also called Apple Silicon, please check my other article.

MacOS Big Sur comes by default with Python 2.7 which, at this point, receives only bug fixes and is EOL since 2020. Python 3 is the future and it is supported by all major Python libraries. In this tutorial, we’ll use Python 3.9 which is the latest stable release of Python at the time of this writing.

Start by installing the Command Line Tools for macOS. Please note, that you will need the Command Line Tools even if you’ve already installed Xcode. Open a Terminal and write:

Install Python Mac Catalina Free

Once the Command Line Tools are installed, we can install Python.

As a side note, after you install the Command Line Tools, you will also get a slightly older Python 3 version (3.8). In this article, we are going to use the latest stable version of Python which, at the time of this writing is 3.9.

Go to https://www.python.org/ and download Python. The official installer of Python is a pkg file that will start a GUI installer which will guide you through the installation.

You can have multiple Python 3 versions installed on your macOS machine. If this is the case, you can select which version you want to use by specifying the version number, e.g.:

or:

After the above, you can invoke Python 3.9 using the python3.9 command. python3 will also invoke the latest installer version of Python 3. This is what I see if I run python3.9 on my machine:

Next, let’s follow best practices and create a new Python environment, named work (feel free to use a different name), in which we can install NumPy, SciPy and Matplotlib:

At this point, your prompt should indicate that you are using the work environment. You can read more about Python environments in the documentation.

Once an environment is activated, all the install commands will apply only to the current environment. By default, if you close your Terminal, the environment is deactivated. If you want to be able to use it, use the source work/bin/activate command.

We can install NumPy, SciPy and Matplotlib with:

Python

As a side note, when you are in an active environment you can use the python command to invoke the Python interpreter, no need to use the version number.

Fire up Python, import scipy and print the version of the installed library. This is what I see on my machine:

Let’s try something a bit more interesting now, let’s plot a simple function with Matplotlib. First, we’ll import NumPy and Matplotlib with:

Next, we can define some points on the (0, 1) interval with:

Now, let’s plot a parabola defined on the above interval:

You should see something like this:

As you’ve probably noticed, plt.show() is a blocking command. You won’t be able to use the interpreter until you close Figure 1.

There is also an interactive mode in which you can plot functions. Close Figure 1 and write:

This is what you should see:

At any point you can disable the interactive plot mode with:

after which you will need to use the plt.show() function in order to actually see the result of the plt.plot function.

If you want to learn more about Python and Matplotlib, I recommend reading Python Crash Course by Eric Matthes. The book is intended for beginners, but has a nice Data Visualization intro to Matplotlib chapter:

Another good Python book, for more advanced users, which also uses Matplotlib for some of the book projects is Python Playground by Mahesh Venkitachalam:

Install Python 2.7 Mac Catalina


Install Python 3 Mac Catalina

Show Comments