我是 python 新手。我正在使用 NetBeans 编写程序。
- NetBeans 8.1
- NetBeans 的 Python 插件
- python 3.5.1
- 插件设置为 3.5.1,而不是默认的 2.7
NetBeans 在我写声明时提示
print ("_ ", end='')
错误是
no viable alternative at input '='
NetBeans 似乎正在检查 2.7 语法,而不是 3.5。我能够运行代码,所以 NetBeans 使用 3.5 来执行。
如何配置 NetBeans 使其使用正确的语法检查?
在@alecxe 的推荐下,我向 NetBeans 报告了一个错误。
NetBeans 不支持 python 3.x。该插件运行正确的版本,但 IDE 语法检查链接到 2.x。
Thank you for your report. Note that we do not officially support Python 3.x yet. However, It is a high-importance task on our nbPython Jira board... Marking this bug as Duplicate. Suggest you follow Bug#229940 for notification.
附言。 PyCharm 很棒。
请您参考如下方法:
这个问题在我这边也可以重现。即使默认的 Python Environment 设置为 Python3.5,Project Interpreter 也设置为 Python3.5,它仍然使用 Python2 特定的语法检查。例如,如果 print 用作语句而非函数,它不会突出显示:
我不认为这种特殊行为是可配置的并且这是一个错误(我怀疑捆绑的 Jython 用于“实时”语法检查)。你绝对应该提出一个问题 here .
PyLint 等外部工具可能会有所帮助,但它是 not yet integrated .
而且,PyCharm 有一个完全免费的社区版。
