You could have multiple Python versions on your macOS.

You may check that by command, type or which command, like:

which -a python python2 python2.7 python3 python3.6

Or type python in Terminal and hit Tab few times for auto completion, which is equivalent to:

compgen -c python

By default python/pip commands points to the first binary found in PATH environment variable depending what's actually installed. So before installing Python packages with Homebrew, the default Python is installed in /usr/bin which is shipped with your macOS (e.g. Python 2.7.10 on High Sierra). Any versions found in /usr/local (such as /usr/local/bin) are provided by external packages.

It is generally advised, that when working with multiple versions, for Python 2 you may use python2/pip2 command, respectively for Python 3 you can use python3/pip3, but it depends on your configuration which commands are available.

It is also worth to mention, that since release of Homebrew 1.5.0+ (on 19 January 2018), the python formula has been upgraded to Python 3.x and a python@2 formula will be added for installing Python 2.7. Before, python formula was pointing to Python 2.

For instance, if you've installed different version via Homebrew, try the following command:

brew list python python3

or:

brew list | grep ^python

it'll show you all Python files installed with the package.

Alternatively you may use apropos or locate python command to locate more Python related files.

To check any environment variables related to Python, run:

env | grep ^PYTHON

To address your issues:

  • Error: No such keg: /usr/local/Cellar/python

    Means you don't have Python installed via Homebrew. However double check by specifying only one package at a time (like brew list python python2 python3).

  • The locate database (/var/db/locate.database) does not exist.

    Follow the advice and run:

    sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
    

    After the database is rebuild, you can use locate command.

Answer from kenorb on Stack Overflow
Top answer
1 of 7
119

You could have multiple Python versions on your macOS.

You may check that by command, type or which command, like:

which -a python python2 python2.7 python3 python3.6

Or type python in Terminal and hit Tab few times for auto completion, which is equivalent to:

compgen -c python

By default python/pip commands points to the first binary found in PATH environment variable depending what's actually installed. So before installing Python packages with Homebrew, the default Python is installed in /usr/bin which is shipped with your macOS (e.g. Python 2.7.10 on High Sierra). Any versions found in /usr/local (such as /usr/local/bin) are provided by external packages.

It is generally advised, that when working with multiple versions, for Python 2 you may use python2/pip2 command, respectively for Python 3 you can use python3/pip3, but it depends on your configuration which commands are available.

It is also worth to mention, that since release of Homebrew 1.5.0+ (on 19 January 2018), the python formula has been upgraded to Python 3.x and a python@2 formula will be added for installing Python 2.7. Before, python formula was pointing to Python 2.

For instance, if you've installed different version via Homebrew, try the following command:

brew list python python3

or:

brew list | grep ^python

it'll show you all Python files installed with the package.

Alternatively you may use apropos or locate python command to locate more Python related files.

To check any environment variables related to Python, run:

env | grep ^PYTHON

To address your issues:

  • Error: No such keg: /usr/local/Cellar/python

    Means you don't have Python installed via Homebrew. However double check by specifying only one package at a time (like brew list python python2 python3).

  • The locate database (/var/db/locate.database) does not exist.

    Follow the advice and run:

    sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
    

    After the database is rebuild, you can use locate command.

2 of 7
50

To check third version, we can use,

python3 --version

To install python on macOS, we need to install command line developer tools. From Catalina, python is removed from OS bundle. For more information, Apple Official and Python Official.

🌐
freeCodeCamp
freecodecamp.org › news › check-python-version-how-to-check-py-in-mac-windows-and-linux
Check Python Version – How to Check Py in Mac, Windows, and Linux
July 7, 2023 - To check the Python version on a Mac, you can follow these steps: You can find the terminal by navigating to "Applications" -> "Utilities" -> "Terminal", or by using Spotlight search (Cmd + Space) and typing "Terminal".
Discussions

How to confirm MacOS "system" Python version - Ask Different
On my machine with macOS 14.2.1 Sonoma, I found more than one python3. I'm not sure any "came with" Sonoma. First, in a terminal, which python3 returns '/opt/homebrew/bin/python3'. I looked in /usr/bin/ and found a python3 there, too. Using /usr/bin/python3 -h gave me too much info but showed a path indicating it was installed with Xcode. Here's a way to get the version... More on apple.stackexchange.com
🌐 apple.stackexchange.com
December 30, 2023
The correct Python version is not showing up in Terminal.
How did you install the newer python version? I see you have anaconda installed so did you create a new environment with conda? (This would be basically: conda create -n myenv python=3.12 conda activate myenv ) If you use conda for virtual environments and managing versions and dependencies it's not a good idea to mix that with other installations from other sources. You likely have the other version installed somewhere but it's not your terminals default Interpreter/installation. See for more detail: https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html More on reddit.com
🌐 r/learnpython
17
2
November 24, 2023
Apple Python Version - Apple Community
Do I have Python and if so do I need it? I am running Sonoma 14.3.1 In Terminal when I type in: which python3 this comes up: /usr/bin/python3 Does that mean this version of python is still on my macbook? Is it necessary? More on discussions.apple.com
🌐 discussions.apple.com
September 20, 2023
Newbie Help: Terminal Can't Find Python
Newbie help! (Mac OS 11.1) I’ve downloaded Python 3.9 and PyCharm and have been working through a “Great Courses” video, but I’m stuck. Terminal does not find 3.9. When I put “python —version” into the Command line, what comes back is “Python 2.716.” I have run “Install ... More on discuss.python.org
🌐 discuss.python.org
17
0
May 31, 2021
People also ask

How to check the Python version on CMD?
To check the Python version in Windows Command Prompt, open CMD and enter “python --versionorpython -V.” These commands will display the Python version that is installed on your system. Additionally, if you have multiple Python versions installed on your system, you may need to use the “python3 --version” command to display the installed version of Python 3.
🌐
superops.com
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
How do I check all my Python versions?
If you have multiple Python versions installed on your computer, and you want to check them all, follow these steps:\n1\n.\n For Windows users\n-Open Command Prompt or PowerShell and run the command “where python.”\n-This command will list all the python.exe paths found in directories listed in your system’s PATH environment variable.\n-After finding all Python executables or paths, you can check the version of each separately.\n-If you have Python Launcher installed on your system, run the command “py -0”\n-This prints all Python versions the launcher can detect.\n2. For Linux and MacOS users
🌐
superops.com
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
What is a Python version file?
A Python version file is a simple text file that specifies which Python version should be used for a particular project or directory. The file contains a single line with a Python version specification like 3.13.1. It is usually used by Python version managers like pyenv, uv, and others to automatically select and activate the specified Python version whenever you work in that directory.
🌐
superops.com
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
🌐
SuperOps
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
2 days ago - Type the following commands and press Enter: “python --version” or “python -V” · If the above commands do not work or display an error message, try using the “python3--version ” command.
🌐
CyberPanel
cyberpanel.net › blog › how-to-check-python-version
Quick Ways to Check Python Version on Mac, Windows & Linux
May 17, 2025 - Type the following command, and then press Enter: python –version This command will display the installed Python version on your Mac. ... For example, if you have Python 3.9.2 installed, it will display something like this: Python 3.9.2 The ...
🌐
Mac Install Guide
mac.install.guide › python › system-default
Check If Python Is Installed · Mac Install Guide · 2026
You'll need a terminal application to check for Python. Apple includes the Mac terminal but I prefer Warp Terminal. Warp increases developer productivity, helping you remember easily-forgotten commands and adds AI troubleshooting. Download Warp Terminal now; it's FREE and worth a try. The current Python version is 3.13, as of October 2024.
Find elsewhere
🌐
DataCamp
datacamp.com › tutorial › check-python-version
How to Check Python Version: Windows, macOS, and Linux | DataCamp
January 28, 2026 - You can run python --version or python3 --version in the terminal to check the Python version. If you are using macOS or Linux systems, python and python3 commands often refer to separate Python installations.
🌐
Quora
quora.com › How-do-I-know-if-Python-is-installed-on-my-Mac
How to know if Python is installed on my Mac - Quora
If Python is installed, the path to the executable will be printed to the terminal. If it’s not installed, nothing will happen. To check the version, use this: python --version (or python3 --version)
🌐
Quora
quora.com › How-do-you-determine-which-Python-version-is-running-on-your-Mac
How to determine which Python version is running on your Mac - Quora
Once opened,type python —version. If python is installed and its path its set it will show the version of python whose path has been set. If python path is not set, “Python is not recognized as internal or external command” will be displayed.
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › python › how to check python version on mac, pc, linux: guide + fixes
How to Check Python Version on Mac, PC, Linux: Guide + Fixes
March 2, 2025 - Use "python --version" to check the system version of Python. Use "python3 --version" to check the version of Python 3, and python2 --version to check the version of Python 2 individually. ... Open a Terminal window.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Check Python Version on Command Line and in Scripts | note.nkmk.me
April 23, 2025 - ... For related topics, such as ... following articles. ... Run the python or python3 command with the --version or -V option in the Command Prompt (cmd) on Windows or the Terminal on macOS and Linux....
🌐
GeeksforGeeks
geeksforgeeks.org › python › check-the-version-of-the-python-interpreter
How to check Python Version : Windows, Linux and Mac - GeeksforGeeks
December 17, 2025 - To check the Python version on ... by searching for "cmd" in the Windows Start menu, or open Terminal for Mac by searching "terminal" in the macOS spotlight search....
🌐
How-To Geek
howtogeek.com › home › web › how to check the python version on windows, mac, and linux
How to Check the Python Version on Windows, Mac, and Linux
October 6, 2023 - To check the Python version on Windows, Mac, or Linux, type "python --version" into PowerShell on Windows, or the Terminal on Linux or Mac.
🌐
Alma Better
almabetter.com › bytes › articles › how-to-check-python-version
How to Check Python Version? (Linux, Windows and Mac)
January 12, 2024 - The terminal will display the installed Python version. Please note that in some cases, the command may return a screen full of information. In such cases, scan through the output to locate the word "python" followed by a version number, which represents the installed Python version. It is possible to have multiple versions of Python installed on the same system. Python 2.7.x and Python 3.7.x can coexist, but they are different programs. To check for Python 2.7.x, use the following command:
🌐
Apple Community
discussions.apple.com › thread › 255135616
Apple Python Version - Apple Community
September 20, 2023 - 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: ... After this PATH change, a python3 script should begin with the following to access /usr/local/bin/python3: ... python was reserved for Python 2.x versions, along with Python 3.x versions under python3.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check python version in linux, windows, and macos
How to Check Python Version in Windows, Linux, and macOS
December 19, 2025 - In this tutorial, learn how to check the Python version on Windows, Linux, or macOS. ... Access to a terminal window/command prompt.
🌐
Reddit
reddit.com › r/learnpython › detecting python version on mac os
r/learnpython on Reddit: Detecting python version on mac os
April 8, 2021 -

Hey guys I have a question that I just couldn't find an answer to looking up online.

I have installed python 3 via homebrew some time ago and updated it today via the same method to version 3.9.4

But when I type python3 --version command in terminal it returns Python 3.9.0

I have tried reintstalling python3 and it finished successfully, it even says that version 3.9.4 is already installed if I try installing it again. Do you know why it shows Python 3.9.0 when calling the python3 --version command?

Thanks in advance guys.