Skip to content

[Solved][MacOS] Big Sur 11.2.1 PyQt5’s Window Cannot Be Showed

I have used PyQt5 to make some simple tools for my daily use. After I switched my daily laptop from Linux to Mac OS, these tools have been working well.

Until recently, a project I was busy writing finally ended, thinking “Oh, I haven’t updated my OS for about five months…” and updated Mac OS to the latest version: Big Sur 11.2.1.

Then the problem occurred.

When I need to use my PyQT5 tool, I waited for a while but my tool window has not been displayed, but the dock below has displayed the tool icon.

I wondered which went wrong, so I did the following two steps:

  • Reboot (Failed, still unable to display PyQt5 window)
  • Only use a terminal with no graphical interface to execute the program (yes, the program can still be run)
  • Clone another project with a graphical interface from GitHub (failed, also unable to display the window)
  • Open the old Linux laptop and execute the same tool (yes, the graphical interface of the old version is displayed normally)

After the above test, I am almost certain that after a version of Mac OS Big Sur, my current PyQt5 version will not work (it should be said that it just cannot display the window)


Solution

After querying related issues on StackOverflow and GitHub, as I expected, it was not just that I encountered this problem. I just upgraded Mac OS later so I encountered it later.

In general, what I see there are two methods:

  • Downgrade PyQt5 to below 1.13.2
  • Turn off the dark mode of MacOS (Many netizens claim that this is the main reason why PyQt5 cannot be displayed)

After I tried it, I did successfully launch the graphical interface of the tool after downgrading.

But even if I turn off the dark mode of Mac OS, I still cannot open the graphical interface of PyQt5 tool.

Maybe my question is different from that of netizens. But I will leave my trial experience as a share.


References


References

Leave a Reply