SoFunction
Updated on 2025-04-14

Solve the problem of pycharm:unused import statement error

pycharm:unused import statement error

Import numpy packages, etc. in pycharm, and sometimes the fonts are gray, and the prompt is "unused import statement".

If the above problems occur, you can try them from the following aspects:

There is Invalidate caches/Restart menu bar under the file menu

Click Clear cache to restart Pycharm

(This poster personally tests that it is effective, but once pycharm is started, it will automatically update and create indexes, etc., and it will turn gray again after the update is completed. Therefore, the best method is the following method 3 - no matter it, it will naturally not turn gray when it is used!)

2. IndentationError:unexpected indent Syntax Error

(1) The most common reason is that the statements are not aligned.

(2) Check whether special characters have been entered.

3. If you find it troublesome, there is another easiest way

Don't worry about it, when you use these packages below, the font will not be gray.

Haha, isn't it very simple!

I read it online and said that this is just a reminder that you have imported it but not used it, not an error, the reason seems to be because PEP8 is turned on and automatic check TKS...

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.