PySide2 application failed to start

前端 未结 2 1453
深忆病人
深忆病人 2021-01-01 05:08

I just tried to test the newly released version of PySide2 (5.11) on Windows 10, 64 bit version. But the \"Hello World\" example does not work. I am using Python 3.6 with Py

相关标签:
2条回答
  • 2021-01-01 05:20

    If you run the app after having set QT_DEBUG_PLUGINS=1, you should get more info on what is the issue. In my case, I was getting:

    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/xxxxx/AppData/Local/py3/platforms" ... qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""

    Such a folder does not exist on my machine.

    There are a few tickets somehow related to a similar issue (not sure it is the same problem):

    • https://bugreports.qt.io/browse/PYSIDE-559
    • https://github.com/pyside/pyside2-setup/issues/57
    • https://github.com/conda-forge/matplotlib-feedstock/issues/2
    • https://github.com/conda-forge/qt-feedstock/issues/71

    My current working solution is to remove PyQt, qt and sip anaconda packages, then to manually delete a relic qt.conf in the root folder of the environment. After that, the official PyPi PySide2 wheel works fine.

    0 讨论(0)
  • 2021-01-01 05:24

    Try This :

    import sys,os
    import PySide2
    
    dirname = os.path.dirname(PySide2.__file__)
    plugin_path = os.path.join(dirname, 'plugins', 'platforms')
    os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path
    
    # code ....... 
    # .......
    
    0 讨论(0)
提交回复
热议问题