简体   繁体   中英

I downloaded Python for Mac and it seems that I have two versions of Python?

When I open my terminal, python --version and python3 --version works. Do I have it twice on my Mac? Does MAC OS X come with Python pre installed? How does my pyCharm IDE know "which" Python to use?

That might just mean that you have both versions of python. Different programs can be run by different versions so that means you can use either of them for running programs or creating your own. As for the interpreter you can choose the version you want to use yourself. Hope this link helps: https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#add_new_project_interpreter

Do I have it twice on my Mac?

Yes. Python 2 and Python 3 are considerably different, and were developed in parallel for quite a number of years. The time of Python 2 has come to an end , but some programs are still not ported to Python 3. Unless you are using a library that is only available on Python 2 (and there should not be many of those any more), you should use Python 3 exclusively.

Does MAC OS X come with Python pre installed?

Yes.

How does my pyCharm IDE know "which" Python to use?

PyCharm documentation has a page on it .

MacOS has come installed with python2 for most, if not all, of its existence, and some parts of the OS still rely on it (Automator tools, xattr command, and others.)

From Catalina onwards, python3 has also been installed (well, as a stub that prompts you to install the Command Line Developer Tools, which includes it).

This, despite Apple's dev notes in Catalina that say that scripting languages such as these will be removed from future versions.

You can of course also install more pythons from https://python.org , or other methods.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM