Python For Mac Catalina

  1. Python Download For Mac Catalina
  2. Python Download For Mac Catalina
  3. Python 2.7 Mac Catalina
  4. Python Os X Catalina
  5. Python Anaconda Mac Catalina

Pip broken under Mac OS X Catalina? TLDR;

Python

How do I set user PATH permanently to be able to access Pipenv from the zsh shell on Mac Catalina? I am installing Pipenv for the first time. After successful installation, I cannot access it from. 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. In Catalina 10.15.4, from Terminal, python2 -version returns Python 2.7.16 python3 -version returns Python 3.7.3 which python or python -version tells what version is used by default. To use python3 instead of python2, I added an alias echo 'alias python='python3' /.zshrc. I am experiencing a Python menu issue on both of my Mac's. One Mac has macOS Catalina and Python 3.7.4 via pyEnv with Tcl/Tk 8.6.9 and the other has macOS Catalina and Python 3.8.0. Via pyEnv and Tcl/Tk 8.6.9 and both area exhibiting the same behavior. This behavior did not exist before upgrading from macOS Mojave to macOS Catalina.

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.

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.

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:

Python Download For Mac Catalina

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]

Python Download For Mac Catalina

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.

Python 2.7 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

Python Os X Catalina

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

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.

Python Anaconda Mac Catalina

[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