I cannot seem to be able to find the setting to enable line numbers for all files, but I have to always right click and enable this on per file basis.
There mu
Using Search bar
Shift
/editor /appearance/
and thenShow line numbers
toggle buttonFor Windows and Linux
File | Settings | Editor | General | Appearance
For macOS
IntelliJ IDEA | Preferences | Editor | General | Appearance
Using shortcut
Ctrl+Alt+S
Then
Editor > General > Appearance
Click on Show line numbers toggle button.
Pycharm Official Doc (Appearance)