当前使用的Python版本是3.4.1,Windows平台
用官方文档里的print方法结果Eclipse提示语法错误 -- syntx error while detecting tuple
代码如下:
print(root, "consumes", end=" ")
原因:Eclipse 设置的python语法还是2.x的
解决方法如下:Eclipse菜单 Project > Properties > Python Interpreter/Grammar
这里我看到我的语法 Grammar Version 选择的是2.7
选择成3.0,然后Apply > OK, 问题解决。
本文介绍了一种常见的Eclipse中使用Python 3.x语法出现错误的情况,并提供了具体的解决步骤。问题出现在使用print函数时,Eclipse提示语法错误。原因是Eclipse配置的Python语法版本为2.x。通过调整Eclipse中的Python Interpreter/Grammar设置,将Grammar Version从2.7更改为3.0,可以解决此问题。
814

被折叠的 条评论
为什么被折叠?



