Wrong Python version in PyCharm's inspections

Go to Settings->Editor->Inspections. There in Python->Code compatibility inspections, you should see that Python 3.5's box is ticked in.

This allows you to choose for which versions of Python your code will be inspected.


I totally agree with @Eskapp's answer, but here are a few additions that I had to do.

  1. Press Ctrl + Alt + S OR Command + Option + S To open the Settings
  2. Settings > Editor > Inspections > Python | Code compatibility inspection > Select the version(s) (In my case 3.7 and 3.8 and disselcting 2.7)
  3. Settings > Project: | Project Interpreter > Make sure correct version and interpreter is selected.
  4. File > Invalidate Caches / Restart...
  5. Done.

Tags:

Pycharm