You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Apple Python Version

I searched for the python version on my MacBook Pro M1 - Ventura 13.5.2 but could not find a "python" program. There's a Python3 in the usr/bin directory, but no python version in the System/Library. I'm afraid I may have accidentally removed the original Python provided with the OS (I can't be sure). What is the python version that should be loaded with Ventura 13.5.2? Also, I noticed when I attempted to update Python3 that I currently have version 3.9. If I removed the original python, how can I restore it? If Python3 is now the default, how can I upgrade it to a newer version? Thank you.

MacBook Pro 14″, macOS 13.5

Posted on Sep 18, 2023 5:02 PM

Reply
7 replies

Sep 20, 2023 1:03 PM in response to Pioneer82

When I install the current release (3.11.5) of Python, I visit Python.org and download their installer. It is a Universal2 (X8 6_64, arm64) binary and normal macOS installer and will ask you for your administrator password, and then install the latest Python3 into these locations:


  • /Library/Frameworks/Python.framework/Versions/3.11
  • /usr/local/bin - these are the python3, pip3, idle3, etc linked from the first bullet bin directory
  • /Applications/Python 3.11 folder


This installation is entirely independent of any Apple command line tools content, and steps on nothing in the operating system. I have this installed on Ventura 13.5.2 and the command line tools because I develop code in Swift or Objective-C (clang) compilers too.


You need to ensure that /usr/local/bin appears before /usr/bin in your PATH to avoid invoking Python 3.9.6. Once you have done that, then you can use the python3 commands in the Terminal and any pip3 installed modules will be installed into the first bullet tree hierarchy.


In your appropriate ˜/.zshrc or ˜/.bashrc or ~/.bash_profile:


export PATH=".:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:${PATH}"


After you save the relevant dot file above, you can either quit the Terminal or do the following to invoke the dot file where whatever is replaced by the specific dot file:


source ~/.whatever


After this PATH change, a python3 script should begin with the following to access /usr/local/bin/python3:


#!/usr/bin/env python3


and it can be run from the Terminal as whichever is appropriate:


python3 some.py
idle3 &
pip3 install -U pip


Sep 19, 2023 6:17 AM in response to Pioneer82

WIth macOS 12.3, Apple removed the deprecated Python 2.7.16 distribution and from future releases of macOS. Apple rewrote in Swift, those parts of the operating system that previously required Python support.


Unless you plan to write code in Python3, you do not need to install it.


If you have installed the current Command Line Tools for Xcode 15, or Xcode 15 itself, then either installation will install the quite outdated Python 3.9.6. Again, if you do not plan to write Python3 code, just ignore its presence after either of these two installations.

Sep 19, 2023 7:32 AM in response to VikingOSX

Thank you. This is fantastic information. I do have one follow-up question to your last paragraph. Indeed, I need to use Python (version 3.x) for my data analysis. I'm not sure how to proceed to upgrade the current 3.9. Should I uninstall the current version and download and install the newer version from python.org? or is there another method? I'm not entirely familiar with the Apple environment and I don't want to break something in the OS.

Apple Python Version

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