How to run QT platform plugin on windows

Viewed 2250

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 Answers

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()
 },

Related