[Solved] PySide2 Failed to Create a Graphical Python Program

Error display

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: direct2d, minimal, offscreen, windows.

Solution:

1. Install pyside2

pip install -U pyside2

2. Find Lib\site-packages\PySide2\__init__.py in the root directory of python

3. Add the following codes:

dirname = os.path.dirname(__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

Read More: