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

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
I started learning Python. I downloaded the latest version to Mac, but when I type python —version via vscode or the computer terminal, it says python not found, but when I say python3 —version, it shows it. Does anyone know what the reason and solution is for this?
That would be because python3 --version is the correct command. More on reddit.com
🌐 r/learnpython
11
0
December 29, 2024
I installed python 3.10 on my Mac but when I enter “python —version” it returns 3.8.3. How do I fix this?
A better option is probably to leave your system version alone and use pyenv. More on reddit.com
🌐 r/learnpython
86
148
June 26, 2022
Python version on MacOS
You can use python environments to specify both python version and pip libraries. I know this doesn't answer your question but I would look into that. I just did brew install but I don't know if that is "right" or "best". More on reddit.com
🌐 r/learnpython
4
1
October 30, 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
🌐
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 ...
Find elsewhere
🌐
Python documentation
docs.python.org › 3 › using › mac.html
5. Using Python on macOS — Python 3.14.3 documentation
Close this terminal window and the installer window. ... A Python 3.14 folder in your Applications folder. In here you find IDLE, the development environment that is a standard part of official Python distributions; and Python Launcher, which handles double-clicking Python scripts from the macOS Finder.
🌐
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)
🌐
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.
🌐
SuperOps
superops.com › superops blog › blog › how to check the python version?
How to check the Python version in quick and easy steps
5 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.
🌐
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....
🌐
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.
🌐
Setapp
setapp.com › how-to › how-to-update-python-on-mac
How to update Python on Mac: Follow this Step-by-step guide
October 16, 2024 - Open Terminal and type the following commands: brew update (updates Homebrew), brew install python (installs the latest Python version). To check the Python version on Mac, open Terminal and type python3 --version or python --version for Python 2.
🌐
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:
🌐
GitHub
github.com › pyenv › pyenv
GitHub - pyenv/pyenv: Simple Python version management · GitHub
This may be helpful to test across Python versions with tox. Depend on Python itself. pyenv was made from pure shell scripts. There is no bootstrap problem of Python. Need to be loaded into your shell. Instead, pyenv's shim approach works by adding a directory to your PATH. Manage virtualenv. Of course, you can create virtualenv yourself, or pyenv-virtualenv to automate the process. ... The Homebrew option from the MacOS section below would also work if you have Homebrew installed.
Starred by 44.5K users
Forked by 3.2K users
Languages   Shell 86.9% | Python 10.8% | Makefile 1.5% | C 0.4% | Roff 0.2% | Dockerfile 0.2%
🌐
Visual Studio Code
code.visualstudio.com › docs › python › python-tutorial
Getting Started with Python in VS Code
November 3, 2021 - Note: To verify that you've installed Python successfully on your machine, run one of the following commands (depending on your operating system): Linux/macOS: open a Terminal Window and type the following command: ... If the installation was ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-install-python-on-mac
How to Install Python on Mac [2025 Guide for M1, M2, M3, and M4 Macs] - GeeksforGeeks
July 12, 2025 - Use the shortcut key Command + Space, type Terminal, and hit Enter. For macOS Catalina or later (default shell is Zsh): ... Press Ctrl + O, then Enter, followed by Ctrl + X. Now use the below command to reload the configuration to add Python ...
🌐
Plain English
python.plainenglish.io › how-to-check-python-version-on-windows-linux-and-mac-2a85df4b1b22
How to Check Python Version on Windows, Linux, and Mac | by Gajanan Rajput💚 | Python in Plain English
November 11, 2024 - Here’s how: ... Open the Command Prompt by typing cmd in the search bar and hit Enter. Type python --version or python -V and press Enter. Your Python version will be displayed on the next line.
🌐
Real Python
realpython.com › installing-python
How to Install Python on Your System: A Guide – Real Python
February 18, 2026 - To take advantage of Python’s ... to work properly. To check which Python version you have on your Mac, open a command-line application like Terminal....