简体   繁体   English

我为Mac下载了Python,看来我有两个版本的Python?

[英]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.当我打开我的终端时, python --versionpython3 --version工作。 Do I have it twice on my Mac?我的Mac上有两次吗? Does MAC OS X come with Python pre installed? MAC OS X 是否预装了 Python? How does my pyCharm IDE know "which" Python to use?我的 pyCharm IDE 如何知道要使用“哪个” Python?

That might just mean that you have both versions of python.这可能只是意味着您拥有两个版本的 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希望这个链接有帮助: https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#add_new_project_interpreter

Do I have it twice on my Mac?我的Mac上有两次吗?

Yes.是的。 Python 2 and Python 3 are considerably different, and were developed in parallel for quite a number of years. Python 2 和 Python 3 有很大不同,并且并行开发了很多年。 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. 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仅使用 Python 3。

Does MAC OS X come with Python pre installed? MAC OS X 是否预装了 Python?

Yes.是的。

How does my pyCharm IDE know "which" Python to use?我的 pyCharm IDE 如何知道要使用“哪个” Python?

PyCharm documentation has a page on it . PyCharm 文档上有一个页面

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.) MacOS 的大部分(如果不是全部)都安装了python2 ,并且操作系统的某些部分仍然依赖它(Automator 工具、 xattr命令等)。

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).从 Catalina 开始, python3也已安装(嗯,作为一个存根,提示您安装命令行开发人员工具,其中包括它)。

This, despite Apple's dev notes in Catalina that say that scripting languages such as these will be removed from future versions.尽管 Apple 在 Catalina 中的开发说明中说,诸如此类的脚本语言将从未来的版本中删除。

You can of course also install more pythons from https://python.org , or other methods.当然,您也可以从https://python.org或其他方法安装更多的 python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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