For Mac Monterey and higher, are there any issues with upgrading Python

In the past, before Apple switched to Python3, it was possible to mess up your Mac installation by removing python2. Are there any similar issues with Python3? Or can we safely just upgrade python and upgrade all the symlinks (from 2 to 3) also to the latest version?

MacBook Pro 13″, macOS 12.5

Posted on Aug 31, 2022 9:56 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 1, 2022 3:09 AM

Whether Xcode, or the command line tools for Xcode, they will install an older version of Python 3. With Xcode, the Python3 framework is internal to the Xcode application with a linked binary into /usr/bin/python3. This does not support the Python/Objective-C scripting bridge. I simply pretend this Python3 does not exist. As you should be aware, Apple removed the Python 2.7.18 distribution from Monterey 12.3.1 and later.


Instead, I install Python 3.10.6 (current) directly from Python.org using their installers. It has a universal2 build, a proper installer resulting in the Python3 installation into /Library/Frameworks/Python.framework/... and the automatically linked executables in /usr/local/bin. It does not step on the Apple Python3 bits, and with PATH changes, one avoids Apple's version altogether. One could even install Python 2.7.18 (though deprecated) in the same manner if migration from 2 to 3 still requires it.


Once one has the Python.org Python3 installed with that PATH adjustment, one can install Python3 compatible third-party solutions (e.g. pyobjc, pyinstaller, Qt6, etc.) without affecting Apple's bits.

5 replies
Question marked as Top-ranking reply

Sep 1, 2022 3:09 AM in response to westred

Whether Xcode, or the command line tools for Xcode, they will install an older version of Python 3. With Xcode, the Python3 framework is internal to the Xcode application with a linked binary into /usr/bin/python3. This does not support the Python/Objective-C scripting bridge. I simply pretend this Python3 does not exist. As you should be aware, Apple removed the Python 2.7.18 distribution from Monterey 12.3.1 and later.


Instead, I install Python 3.10.6 (current) directly from Python.org using their installers. It has a universal2 build, a proper installer resulting in the Python3 installation into /Library/Frameworks/Python.framework/... and the automatically linked executables in /usr/local/bin. It does not step on the Apple Python3 bits, and with PATH changes, one avoids Apple's version altogether. One could even install Python 2.7.18 (though deprecated) in the same manner if migration from 2 to 3 still requires it.


Once one has the Python.org Python3 installed with that PATH adjustment, one can install Python3 compatible third-party solutions (e.g. pyobjc, pyinstaller, Qt6, etc.) without affecting Apple's bits.

Sep 1, 2022 7:08 AM in response to westred

Python is no longer included with the operating system. Python3 is part of Xcode, but you shouldn't attempt to upgrade it, or even use it for that matter. Apple includes Python3 for its own purposes. If you want to use Python, install your own modules, and keep it updated, that is for you to do. It is common to have multiple versions of Python installed. It is your responsibility to properly manage that.

Sep 1, 2022 9:16 AM in response to westred

I use homebrew myself for limited utilities, but never use it to install any flavor of Python, or override the Python2/3 installation from the Python.org installers if there is a homebrew package dependency for Python. When Python 3.10.7 arrives, I will simply download the Python.org installer for it and just run it to update my Python3 installation.


Understand how to setup explicit Python virtual environments (venv) and restrict specific development and packages to them. I have an environment configured where I installed the pyobjc, pyinstaller (.app), and Qt6 packages.

Sep 1, 2022 8:36 AM in response to westred

westred wrote:

What thoughts from the community on using home-brew to install

I commonly see questions from people using homebrew that have completely scrambled their Terminal environment and can't figure out how to fix it. It is a nice time-saver if you already know how to do things properly, but just don't want to bother. But if you don't already know how, or don't know how to correct problems, it's a big risk.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

For Mac Monterey and higher, are there any issues with upgrading Python

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.