Install Python Mac Catalina

Supported platforms

  • 10.6 (Snow Leopard)
  • 10.7 (Lion)
  • 10.8 (Mountain Lion)
  • 10.9 (Mavericks)
  • 10.10 (Yosemite)
  • 10.11 (El Capitan)

Prerequisites

To develop applications using the GStreamer SDK for OS X you will needOS X Snow Leopard (10.6) or later andXCode 3.2.6 orlater.

MacOS 10.15 (Catalina) now ships with Python3 but I would recommend installing a second version as not to “upset” the OS native shipped version. The book recommends Python 3.6.6 (at time of writing), I have based this post on Python 3.7.7 (I recommend not going to a higher version as Pygame Zero still has some install issues on the latest. If you are just getting started with Python development on a macOS, do the necessary configurations to make sure you're using the right version of Python from the start. Installing Python 3, with or without Homebrew, and using alias will let you start coding, but it's not a good strategy for the long run. Link to Installing the latest version of Python on Mac OS Catalina and overriding the old default pre-installed version podcast on anchorfm I finally did it. I successfully installed Python version 3.7.7 via Homebrew on my Mac laptop with OS Catalina installed.

The recommended system is macOS Sierra withXCode 8

Download and install the SDK

There are 3 sets of files in the SDK:

  • The runtime files are needed to run GStreamer applications. Youprobably want to distribute these files with your application (orthe installer below).
  • The development files are additional files you need to createGStreamer applications.
  • Mac OS X packages that you can usewith PackageMakerto deploy GStreamer with your application

Get both the runtime and the development installers from here.

On Mac OS X 10.6 (Snow Leopard) you have to install Python 2.7 manually. It is included in later versions of OS X already. You can get it from here.

The downloads areInstaller Packages(.pkg).

Double click the package file and follow the instructions presented bythe install wizard. In case the system complains about the package notbeing signed, you can control-click it and open to start theinstallation. When you do this, it will warn you, but there is an optionto install anyway. Otherwise you can go to System Preferences → Securityand Privacy → General and select the option to allow installation ofpackages from 'anywhere'.

These are some paths of the GStreamer framework that you might finduseful:

  • /Library/Frameworks/GStreamer.framework/: Framework's root path
  • /Library/Frameworks/GStreamer.framework/Versions: path with all theversions of the framework
  • /Library/Frameworks/GStreamer.framework/Versions/Current: link tothe current version of the framework
  • /Library/Frameworks/GStreamer.framework/Headers: path with thedevelopment headers
  • /Library/Frameworks/GStreamer.framework/Commands: link to thecommands provided by the framework, such as gst-inspect-1.0 orgst-launch-1.0

For more information on OS X Frameworks anatomy, you can consult thefollowing link

Configure your development environment

Install Python 2.7 Mac Catalina

Building the tutorials

The tutorials code, along with project files and a solution file forthem all, are in thegst-docs in theexamples/tutorials subdirectory.

Install Python Mac Catalina Update

Python

To start building the tutorials, create a new folder in your Documentsdirectory and copy thefolder /Library/Frameworks/GStreamer.framework/Current/share/gst-sdk/tutorials.

You can fire up XCode and load the project file.

Press the Run button to build and run the first tutorial. You canswitch the tutorial to build selecting one of the available schemes.

Install python mac catalina update

Creating new projects

The GStreamer binaries provides aframeworkthat you can drag and drop to XCode to start using it, or using thelinker option -framework GStreamer*.*

There is a small exception to the regular use of frameworks, and youwill need to manually include the headers searchpath /Library/Frameworks/GStreamer.framework/Headers

  • XCode: Add the headers path to Search Paths → Header SearchPaths
  • GCC: Using the compileroption -I/Library/Frameworks/GStreamer.framework/Headers

Pip broken under Mac OS X Catalina? TLDR;

pip install --global-option=build_ext --global-option='-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/' --global-option='-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/' --prefer-binary -r requirements.txt

As Apple has announced, Mac OS Catalina now runs under its own read only file system:

macOS Catalina runs on a dedicated, read-only system volume called Macintosh HD. This volume is completely separate from all other data to help prevent the accidental overwriting of critical operating system files. [1]

Sounds great. But if you need to change that volume, or if you use software that expects to be able to find files on that read only volume that aren't there and can't be added, you're kind of stuck.

Install Python Mac Catalina

One example is Python's pip which, for some packages, will expect to find header files located in /usr/include. Apple gave developers a get-out-of-jail-free card in Mojave:

As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. [2]

and in true Apple fashion, the package was taken away. This creates problems if you want to install commonly used, but maybe not so commonly maintained, libraries. One example is Pillow, an image processing library. This will well and truly fail to compile if you just try pip install Pillow. It looks for the headers and libraries, and doesn't find them.

Install Python On Mac Catalina

What can we do? Well, for pip there's a few options. The first is simply not to compile at all, but to prefer a binary. This is as simple in some cases as the --prefer-binary option. But what if, like Pillow, there is no precompiled binary for your platform? Or for reasons of information security, you have to compile it yourself?

Fortunately, pip can be directed to look in different places using the 'global-options' flag. To get Pillow to build, use the command at the top of this article, reproduced below:

pip install --global-option=build_ext --global-option='-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/' --global-option='-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/' --prefer-binary -r requirements.txt

To understand this more fully, take a look at https://stackoverflow.com/questions/18783390/python-pip-specify-a-library-directory-and-an-include-directory.

Install Python 3 Mac Catalina

If you need to do a similar function as part of other install tools, common environment variables are LD_LIBRARY_PATH (deprecated[3], but still commonly used), LIBRARY_PATH and INCLUDE_PATH. Setting these to the library paths (/Library ... /usr/lib) and include paths (/Library ... /usr/include) respectively may help.

Install Python Mac Catalina Operating System

[1]https://support.apple.com/en-gb/HT210650
[2]https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624
[3]https://stackoverflow.com/questions/18241517/c-include-path-vs-ld-library-path