Python version different to Python Framework version

bashcommand linepython

When I ask for my system version in python interpreter, the answer is 2.7.10 :

Python 2.7.10 (default, Jul 30 2016, 18:31:42) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print (sys.version)
2.7.10 (default, Jul 30 2016, 18:31:42) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

However, browsing /Library/Frameworks/Python.framework/Versions, I can only find 3.5, why?

Best Answer

It is possible to have multiple different python installations on macOS. And the user is able to choose where they are installed.

For example, I have the standard Python that comes with macOS, as well as one that came with Anaconda that I use for my Python development.

To make things easier, I linked my system Python to Anaconda's Python interpreter. However, this does not delete the Python version in my system's library, merely stops linking against it.

If you're ever confused which interpreter is being used to run your code in terminal, I find a simple way to find out is to simply type the Terminal command "which python". That will quickly output the location of the Python interpreter being used by your system by default. In my case it outputs "/anaconda/bin/python".

enter image description here