Wednesday, 9 April 2014

python 3.3, pyqt5 and cx_freeze exe on 64-bit windows

I am going to build a pyqt5 app on windows with python 3.3

the development platform:
1) Python 3.3.5x86-64 installer from
3) cx_freeze for Python 3.3 64 bit from

install those applications, after that open windows command prompt by clicking start -> run (or Winkey+r shortcut)-> cmd -> enter, change directory to your python installion path, 'cd \python33' (change the path if you are not using default path and type without quotes)

then run '   python.exe -c "import sys; print (sys.version)"   ' in the prompt, you will get output like this,
3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:35:05) [MSC v.1600 64 bit (AMD64)]'

run ' path ', you will get,
PATH=C:\Python33\Lib\site-packages\PyQt5; ... more path here ...

also, check these paths exist, if they doesn't exist, there is something wrong of the installation

the hello world source code from
#!/usr/bin/env python3
#-*- coding: utf-8 -*-

PyQt5 で Hello, world!

import sys
from PyQt5 import QtWidgets

def main():
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QMainWindow()
    button = QtWidgets.QPushButton("Hello, PyQt!")

if __name__ == '__main__':
copy and paste the code to your IDE, for example, PyCharm, at this moment you can use windows notepad and save the file to (for example): C:\Users\Administrator\Desktop\py33src\

to run it
in the command prompt, change directory to your python.exe path, 'cd \python33' (if you are not in that path), type ' python.exe c:\Users\Administrator\Desktop\py33src\ ', you will get your hello world run

compile/pack/freeze python source code to exe for platform without python,
in command prompt, change directory to C:\Python33\Scripts by typing '  cd c:\python33\scripts  '
type and run:
cxfreeze.bat --base-name=Win32GUI c:\Users\Administrator\Desktop\py33src\
you will get helloqt.exe and its dependence files inside C:\Python33\Scripts\dist
note that --base-name=Win32GUI here is to hide the console window, you can try to compile without it to test the result

remind that libEGL.dll should be copied from C:\Python33\Lib\site-packages\PyQt5 to the same folder of the outputted .exe for the machine with no PyQt5 installed, otherwise the program will complain 'This application failed to start because it could not find or load the Qt platform plugin "windows"'

PyQt5 Reference Guide:

PyQt5 Beginner tutorial:


judicockfight said...

Sudah seru, odds nya menguntungkan lagi!!. itulah permainan sabung ayam online di
Dapatkan informasi penting dalam dunia sabung ayam di website bawah ini

haruka kimizuki said...

Link Alternatif S1288poker

S1288poker Judi POker Online

CS S1288poker

S1288poker Indonesia

haruka kimizuki said...

Link Alternatif S1288poker

S1288poker Judi Poker Online

CS S1288poker

S1288poker Indonesia


Search This Blog