简体   繁体   English

pycharm中如何禁用错误消息'打印关键字不能在Python 2中用作标识符'?

[英]How to disable errorr message 'print keyword can't be used as identifier in python 2' in pycharm?

I am using PyCharm 2018.3.4 (Professional Edition) and I keep getting this error messsage even on simple statements such as 我正在使用PyCharm 2018.3.4(Professional Edition),即使在诸如

print(matching_bids)

or 要么

print("packed",str(packed))

I know this is more of a suggestion, but the only 3 top results in Google talk about this problem, and there is an unanswered question about this in the jetbrains forum . 我知道这更多是一个建议,但是Google仅有的3个顶级结果谈到了这个问题,而jetbrains论坛中对此没有一个未解决的问题 Hence, I have no idea what to do about this error, because it cannot be a syntax error. 因此,我不知道该怎么办,因为它不能是语法错误。 I am not able to disable it from the inspections either, and cannot disable 'All Inspections' just for this and write more erroneous code without pertinent warnings. 我也不能从检查中禁用它,也不能为此禁用“所有检查”,并且在没有相关警告的情况下编写更多错误代码。

Even if I create a new .py file and just enter 即使我创建一个新的.py文件并输入

print("hi")

it still shows this error. 它仍然显示此错误。

弹射

I am using 3.7 python with a django ver 2.0.1 我正在将3.7 python与Django ver 2.0.1一起使用

Update: This is my project interpreter: 更新:这是我的项目解释器:

s

As pointed out by @rdas in comments. 正如@rdas在评论中指出的那样。 Please make sure you have set Python 3 as your project interpreter. 请确保已将Python 3设置为项目解释器。

Reference : https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html 参考: https : //www.jetbrains.com/help/pycharm/configuring-python-interpreter.html

Based on the update of your post, to just disable the error do this: 根据您帖子的更新,要仅禁用错误,请执行以下操作:

  1. Go To File > Settings > Editor > Inspections 转到文件>设置>编辑器>检查

  2. Search for "identifier" 搜索“标识符”

  3. Disable "Correctness of identifier reference" 禁用“标识符引用的正确性”

I do not recommend this but if you see no other way to solve this issue this is a temporary fix. 我不建议这样做,但是,如果您没有其他方法可以解决此问题,则这是暂时的解决方法。

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

相关问题 打印 [Python] 在 Pycharm 中被视为关键字 - Print [Python] seen as a keyword in Pycharm 可以将“ with”用作Python中的标识符吗? - Can “with” be used as an identifier in Python? 在远程 python 3 解释器周围使用包装器时,如何在 Pycharm 中禁用 python 2.7 代码兼容性错误消息? - How can I disable python 2.7 code compatibility error message in Pycharm when using wrapper around remote python 3 interpreter? 无法解决错误消息“预期的二维数组,而是得到一维数组”? - Can't solve the errorr message "Expected 2D array, got 1D array instead"? 我无法修复运行时错误 - I can't fix Runtime Errorr 如果没有目录,如何禁用该消息? 蟒蛇 - If there is not a directory, how can I disable the message? python 如何在python中禁用webbrowser消息? - How can I disable the webbrowser message in python? 如何在python 3.x中使用print作为关键字的情况下运行旧代码? - how to run old code where print is used as keyword with python 3.x? 与'as'关键字一起使用时,覆盖python open函数以打印任何内容 - Override python open function when used with the 'as' keyword to print anything 如何在Python中的字符串中打印递增的int标识符 - How to print an incremented int identifier in a string in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM