如何在 PyCharm 中设置 Python 2 首选项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15845929/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set the Python 2 Preference in PyCharm?
提问by DeepMind
PyCharmis a good IDE, but its code hinting is not so intelligent. For example, when I use it to write Python2 code (the setting of my interpreter pathcan tell PyCharm this), I type prin, which I want PyCharm to give me a hint of print, however, the first prompt is print(), which is a Python3 style of function print. Is there any setting in PyCharm that I can tell it not to give me Python3 prompt when I am writing Python2 code (and not to give me Python2 prompt when I am writing Python3 code)?
PyCharm是一个不错的 IDE,但是它的代码提示不是那么智能。例如,当我使用它编写 Python2 代码时(我的解释器路径的设置可以告诉 PyCharm 这个),我输入prin,我希望 PyCharm 给我一个提示print,但是,第一个提示是print(),这是 Python3 风格的函数print。PyCharm 中是否有任何设置可以告诉它在我编写 Python2 代码时不给我 Python3 提示(并且在我编写 Python3 代码时不给我 Python2 提示)?
My PyCharm version is 2.7.1
我的 PyCharm 版本是 2.7.1
回答by monoid
Perhaps, you should select python 2.x interpreter for the project (File Menu - Settings - Project - Project Interpreter).
也许,您应该为项目选择 python 2.x 解释器(文件菜单 - 设置 - 项目 - 项目解释器)。
回答by MatheMatrix
Maybe this can help:
也许这可以帮助:
Run->Edit Configurations, Replace all Py3 to Py2
运行->编辑配置,将所有 Py3 替换为 Py2
I use PyCharm 3.0.1
我使用 PyCharm 3.0.1
回答by IRSHAD
Simply set the Python Interpreter from 3.xto 2.xas you want.
从简单的设置Python解释器3.X到2.x的,只要你想。
Steps of PyCharm Version: Community Edition 2016.3.2
PyCharm 版本步骤 :社区版 2016.3.2


