Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等

时间:2024-04-03 18:10:29

作为一名小白,在用PyCharm编写程序时经常被各种波浪线所困扰。但是其中很多提示的错误都是不影响代码运行的,想关闭这些没用的提示就需要进行一些设置。
代码检查设置
首先,一般都要进行的设置,打开File>>settings>>Editor>>Inspections,在右侧将Spelling取消勾选。
Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等
之后需要关闭Python中的俩个PEP8代码风格的检查。设置好之后就发现编写代码中密密麻麻的波浪线不见了。
Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等
Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等

选择性关闭代码警告
按照之前的步骤设置之后,有时候还会发现有很多不必要的提示,这是就需要选择性的关闭这些提示。
下面针对几种代码警告举例进行设置,打开File>>Editor>>Inspections,打开右侧Python下面的列表。
首先是针对提示加载的包未被使用的提示。
Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等
在列表中取消勾选按即可。Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等
如下图提示“This inspection detects shadowing names defined in outer scopes”,这个问题困扰了很久,因为是小白又有些强迫症,之前总是挨个的改变量名。后来发现这个提示不影响代码运行。。。
Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等
取消勾选Python下面Shadowing names from outer scopes项即可。

Pycharm关闭错误提示,关闭“This inspection detects shadowing names defined in outer scopes.”等
还有其他一些代码警告,可以根据情况选择关闭。

以上是我在学习Python编程中遇到的一些问题,总结出来分享一下,希望能帮到和我遇到同样问题的同学。