Search code examples
pythonmacoscpython

Preinstalled python on mac a cpython?


As the title says,I want to know if the python which comes pre installed on mac is cpython. I mean logic says it probably is,but I couldn't find it being written anywhere officially so wanted to confirm.

I want to download a few things and for compatibility they require the installed python to be cpython/iron python.


Solution

  • With command Python --version you get the information like that:

    [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin

    It is almost affirmative that it is cpython with gcc as compiler.

    An alternative(which is more official) is to check with python code:

    import platform
    platform.python_implementation()
    

    The function python_implementation:

    Returns a string identifying the Python implementation. Possible return values are: ‘CPython’, ‘IronPython’, ‘Jython’, ‘PyPy’