0

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?

0

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

  • Thank you for your answer, you say that you linked your system python to Anaconda's interpreter, how could I link mine to 3.5 Python version located in /Library/Frameworks/Python.framework/Versions ? – Anosen Nov 6 '16 at 13:11
  • The method you use depends on your specific use case, as with some people a simple alias for the terminal command "python" to "python3" is enough. But if you need something lower level, try looking at this answer: stackoverflow.com/a/15285703/4111864 – HMSCelestia Nov 8 '16 at 15:57
  • If the my answer was helpful please remember to click the checkbox marking it as the "accepted" answer! – HMSCelestia Nov 8 '16 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .