[python] What version of Python is on my Mac?

I have a mac, when I do:

python --version 

I got:

Python 2.7.6

but when I got to:

/System/Library/Frameworks/Python.framework/Versions/3.3

where is 2.7.6 located ? any advice what should I do?

UPDATE:

$ which -a python python3
/usr/bin/python
/usr/local/bin/python3

$ brew list python python3
Error: No such keg: /usr/local/Cellar/python

$ locate python

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:



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

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

in PyCharm editor, the default settings interpreter shows:

This question is related to python macos

The answer is


Use below command to see all python installations :

which -a python

If you have both Python2 and Python3 installed on your Mac, you can use

python --version

to check the version of Python2, and

python3 --version

to check the version of Python3.

However, if only Python3 is installed, then your system might use python instead of python3 for Python3. In this case, you can just use

python --version

to check the version of Python3.


Use the which command. It will show you the path

which python

To check third version, we can use,

python3 --version

Take a look at the docs regarding Python on Mac.

The version at /System/Library/Frameworks/Python.framework is installed by Apple and is used by the system. It is version 3.3 in your case. You can access and use this Python interpreter, but you shouldn't try to remove it, and it may not be the one that comes up when you type "Python" in a terminal or click on an icon to launch it.

You must have installed another version of Python (2.7) on your own at some point, and now that is the one that is launched by default.

As other answers have pointed out, you can use the command which python on your terminal to find the path to this other installation.


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to macos

Problems with installation of Google App Engine SDK for php in OS X dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac Could not install packages due to an EnvironmentError: [Errno 13] How do I install Java on Mac OSX allowing version switching? Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Can't compile C program on a Mac after upgrade to Mojave You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) How can I install a previous version of Python 3 in macOS using homebrew? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"