How to run QT platform plugin on windows

百般思念 提交于 2021-01-28 02:49:01

问题


I use Anaconda3 5.2.0 and jupyter notebook(python3)(Window10)

I made a file through 'pyinstaller'. But when I play file that I made, It has some Error.\

there are qwindows, qoffscreen, qminimal, qdirect2d .dall in platforms folder

============================================================================= qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized.

Reinstalling the application may fix this problem.

Available platform plugins are: minimal, offscreen, windows.

===========================================================================

The list that I tried

  1. conda update qt

  2. Copy Anaconda3\Library\plugins\platforms folder to Anaconda3

  3. reinstall Anaconda3

  4. reinstall PyQt5


回答1:


I had a similar problem. With Anaconda, you need to bundle the platforms directory with your frozen application. I do it as follows:

def get_include_files():
    file_list = []
    d = os.path.abspath('C:\Anaconda2\envs\py3k\Library\plugins\platforms') #You need to change this
    file_list.append(d)
    #file_list.append('images')
    return file_list

Then in setup.py, just add these files as follows:

'build_exe': {
  'include_files': get_include_files()
 },


来源:https://stackoverflow.com/questions/53237963/how-to-run-qt-platform-plugin-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!