
ุจุงูุชุฃููุฏ ุ ูู ู
ู ูุชุจ ุดูุฆูุง ูุงุญุฏูุง ุนูู ุงูุฃูู ูู Python ููุฑ ูู ููููุฉ ุชูุฒูุน ุจุฑูุงู
ุฌูู
(ุฃู ุญุชู ุจุฑูุงู
ุฌ ูุตู ุจุณูุท) ุฏูู ุฃู ุตุฏุงุน: ุฏูู ุงูุญุงุฌุฉ ุฅูู ุชุซุจูุช ุงูู
ุชุฑุฌู
ููุณู ุ ูุงูุชุจุนูุงุช ุงูู
ุฎุชููุฉ ุ ุนุจุฑ ุงููุธุงู
ุงูุฃุณุงุณู ุ ู
ู ุฃุฌู ุงุณุชุฎุฏุงู
ู
ูู ูุงุญุฏ -exe'shnikom (ูู
ูุงุฐ ุฃุฎูุฑ ุ ุฃุฑุดูู) ูุฃุตุบุฑ ุญุฌู
ู
ู
ูู.
: PyInstaller, cx_Freeze, py2exe, py2app, Nuitka โฆ , PyQt? , ( ) , PyQt, PyQt pyqtdeploy. , , , . , , , โ ( ). , : , , , , .
pyqtdeploy , , , , ?
. linux. , "exe'" .
, ( ). PyInstaller โ , , . 170 ( , PyQt5 180 ). , , โ QtCore, QtGui, QtWidgets โ . --exclude-module
. , --onefile
, 60 , . , , ( - ) 170 .
pyqtdeploy. " PyQtโฆ - , - PyQt Qt?" โ .
pyqtdeploy? , , . ( , PyQt, ) Qt ( rcc) , C++, , //โฆ . pyqtdeploy Python 3.5+ PyQt5. ( ):
- exe' PyQt4 PyQt5, Python 2.7 Python 3.3+ ( Python 3.7.2);
- ( exe') ( , โ );
- :
- android-32;
- android-64;
- ios-64;
- linux-64;
- macos-64;
- win-32;
- win-64;
- PyQt Qt , - QtCore, - .
pyqtdeploy
, Python 3.5+ PyQt5:
pip install PyQt5 pyqtdeploy
exe' :
- Python-, (!);
- sysroot , ;
- "" .pdy, exe' ( Qt, PyQt, Python, );
- exe' qmake.
: main.py โ " " , mainwindow.py โ , resources icon.png mainwindow.ui, Qt Designer. , :
main.py
src/
|---__init__.py
|---gui/
|---mainwindow.py
|---__init__.py
|---resources/
|---__init__.py
|---images/
|---icon.png
|---__init__.py
|---ui/
|---mainwindow.ui
|---__init__.py
sysroot ()
, , . sysroot.json ( , ). , (Python, Qt ..). pyqtdeploy API, , //whatever, pyqtdeploy. ( ):
openssl ( ) โ (). , sysroot.json, :
"android|macos|win#openssl": {
"android#source": "openssl-1.0.2r.tar.gz",
"macos|win#source": "openssl-1.1.0j.tar.gz",
"win#no_asm": true
}
, , : arch1|arch2|...#plugin-name
. , (ios, android, macos, win, linux), โ . , .
:
- source () โ ;
- no_asm ( ) โ . , PATH nasm;
- python_source ( ) โ , , OpenSSL macOS Python v3.6.4 ;
zlib ( ) โ ( , , , ) ():
"ios|linux|macos|win#zlib": {
"source": "zlib-1.2.11.tar.gz",
"static_msvc_runtime": true
}
:
- source () โ , ;
- static_msvc_runtime ( ) โ MSVC (Windows);
qt5 () โ ():
"qt5": {
"android-32#qt_dir": "android_armv7",
"android-64#qt_dir": "android_arm64_v8a",
"ios#qt_dir": "ios",
"linux|macos|win#source": "qt-everywhere-src-5.12.2.tar.xz",
"edition": "opensource",
"android|linux#ssl": "openssl-runtime",
"ios#ssl": "securetransport",
"macos|win#ssl": "openssl-linked",
"configure_options": [
"-opengl", "desktop", "-no-dbus", "-qt-pcre"
],
"skip": [
"qtactiveqt", "qtconnectivity", "qtdoc", "qtgamepad",
...
],
"static_msvc_runtime": true
}
:
- qt_dir ( , source) โ Qt;
- source ( , qt_dir) โ Qt;
- edition (, source) โ 2 :
- ssl โ 3 :
- openssl-linked โ ( openssl);
- securetransport โ SSL, Qt (, , Appleโs Secure Transport);
- openssl-runtime โ OpenSSL, ;
- configure_options โ , Qt. , ;
- skip โ ( , top-level , ). Qt , qt โ top-level . , , . , top-level ();
- disabled_features โ .
configure -list-features
() - static_msvc_runtime ( ) โ MSVC (Windows);
python () โ ():
"python": {
"build_host_from_source": false,
"build_target_from_source": true,
"source": "Python-3.7.2.tar.xz"
}
:
- build_host_from_source () โ true โ Python , false โ Python ( win32);
- build_target_from_source () โ true โ Python , false โ Python ( Python win32);
- source (, Python ) โ Python;
- version (, Python) โ Python;
- dynamic_loading ( ) โ true โ (, C);
- host_installation_bin_dir ( ) โ Python, ( , win , โ PATH);
sip () โ , Python-bindings C/C++ ( ):
"sip": {
"module_name": "PyQt5.sip",
"source": "sip-4.19.15.tar.gz"
}
:
- module_name () โ sip-;
- source () โ sip;
pyqt5 () โ ():
"pyqt5": {
"android#disabled_features": [
"PyQt_Desktop_OpenGL", "PyQt_Printer", "PyQt_PrintDialog",
"PyQt_PrintPreviewDialog", "PyQt_PrintPreviewWidget"
],
"android#modules": [
"QtCore", "QtGui", "QtNetwork", "QtPrintSupport", "QtWidgets",
"QtAndroidExtras"
],
"ios#disabled_features": [
"PyQt_Desktop_OpenGL", "PyQt_MacOSXOnly",
...
],
"ios|macos#modules": [
"QtCore", "QtGui", "QtNetwork", "QtPrintSupport", "QtWidgets",
"QtMacExtras"
],
"linux#modules": [
"QtCore", "QtGui", "QtNetwork", "QtPrintSupport", "QtWidgets",
"QtX11Extras"
],
"win#disabled_features": ["PyQt_Desktop_OpenGL"],
"win#modules": [
"QtCore", "QtGui", "QtNetwork", "QtPrintSupport", "QtWidgets",
"QtWinExtras"
],
"source": "PyQt5_*-5.12.1.tar.gz"
}
:
- disabled_features ( ) โ . , , Qt ();
- modules () โ , ();
- source () โ PyQt;
pyqt3D, pyqtchart, pyqtdatavisualization, pyqtpurchasing, qscintilla ( ) โ , PyQt. source
โ .
, . sysroot , . , , .
sysroot
sysroot.json :
{
"linux#zlib": {
"source": "zlib-1.2.11.tar.gz"
},
"linux#qt5": {
"source": "qt-everywhere-src-5.12.2.tar",
"edition": "opensource",
"configure_options": [
"-no-dbus", "-no-system-proxies", "-no-cups", "-no-sql-db2",
"-no-sql-ibase", "-no-sql-mysql", "-no-sql-sqlite",
"-no-sql-sqlite2", "-no-sql-oci", "-no-sql-odbc",
"-no-sql-psql", "-no-sql-tds", "-no-sqlite", "-ccache",
"-optimize-size"
],
"skip": [
"qt3d", "qtactiveqt", "qtandroidextras", "qtcanvas3d",
"qtcharts", "qtconnectivity", "qtdatavis3d", "qtdeclarative",
"qtdoc", "qtgamepad", "qtgraphicaleffects", "qtlocation",
"qtmacextras", "qtmultimedia", "qtnetworkauth", "qtpurchasing",
"qtquickcontrols", "qtquickcontrols2", "qtremoteobjects",
"qtscript", "qtscxml", "qtsensors", "qtserialbus",
"qtserialport", "qtspeech", "qtsvg", "qttools",
"qttranslations", "qtvirtualkeyboard", "qtwayland",
"qtwebchannel", "qtwebengine", "qtwebglplugin",
"qtwebsockets", "qtwebview", "qtwinextras", "qtx11extras",
"qtxmlpatterns"
],
"disabled_features": [
"network", "bearermanagement", "dnslookup", "dtls", "ftp",
"http", "localserver", "networkdiskcache", "networkinterface",
"networkproxy", "socks5", "udpsocket", "concurrent", "future",
"cups", "printer", "printdialog", "printpreviewdialog",
"printpreviewwidget", "sql", "sqlmodel", "testlib", "xml"
]
},
"linux#python": {
"build_host_from_source": false,
"build_target_from_source": true,
"source": "Python-3.7.2.tgz",
"dynamic_loading": true
},
"linux#sip": {
"module_name": "PyQt5.sip",
"source": "sip-4.19.15.tar.gz"
},
"linux#pyqt5": {
"modules": ["QtCore", "QtGui", "QtWidgets"],
"source": "PyQt5_*-5.12.2.tar.gz"
}
}
? -, (, ssl, pyqt3D ). -, exe' linux ( , linux-64; , ).
, qt5 - , (, ). top-level QtBase. -optimize-size
-ccache
. Qt , , ( 5 ), , โ ccache ( , linux), ( 5). , apt install ccache
.
pyqt5 QtCore, QtGui, QtWidgets.
python dynamic_loading
, C-extension.
sysroot, : zlib, Qt5, Python, sip, PyQt5 sysroot.json ( , ). :
pyqtdeploy-sysroot sysroot.json
, .
--verbose
. , , . , dev-. , . , python3-dev, (, Requirements). , Qt Python ( , ).
, , , .
"" ()
, , exe'. pyqtdeploy GUI. ( .pdy ):
pyqtdeploy main.pdy

Application Source. :
- Name โ exe';
- Main script file ( , Entry Point) โ , ( , main.py);
- Entry Point ( , Main script file) โ , setuptools;
- sys.path โ , zip- (, Python egg), sys.path ( , , );
- Target Python version โ Python;
- Target PyQt version โ PyQt4 PyQt5 (, , PyQt, );
- Use console โ , ( Windows). ;
- Application bundle โ , bundle ( MacOS);
- Application Package Directory โ , . Scanโฆ "" (src) main.py, , . (.. main.py src), main.py ( , Main script file).
: .py "" ( -) โ .
:
- Scanโฆ โ Application Package Directory;
- Remove all โ Application Package Directory;
- Include all โ Application Package Directory;
- Exclude all โ Application Package Directory;
- Exclusions โ , Application Package Directory. ;
qmake. qmake, ( );

PyQt Modules. PyQt-, . , . QtCore, QtGui, QtWidgets, uic; sip .
PyQt, , ( ).

Standard Library. , , . - , . ( ) , ().
. - ( pip), - ( ), ImportError
. . , PIL, fractions.
Python / (, ssl), . , . INCLUDEPATH (headers), LIBS โ ( , ).

Other Packages. (, pypi). , Application source: , ( , site-packages virtual environment), Scan / ( PIL).
Other Extension Modules. C, exe' (; , , ).
, . . Package Lib.a, Name , โ Package.Lib ( .a); LIBS , , -L/home/user1/venv/programme1/lib/python3.7/site-packages/Package -lLib ( , " ", /home/user1/venv/programme1/lib/python3.7/site-packages/Package/Lib.a).
, , -, , -, qmake ( , pyqt' ).
, , , Lib.so? โ Package.Lib.so (.. , + ) exe'. , . , ImportError
. , , _imaging.so, PIL'.
Locations. , . ( sysroot , main.pdy), .
exe' ()
- :
pyqtdeploy-build main.pdy
cd build-linux-64
../sysroot-linux-64/host/bin/qmake
make #nmake win
, , โ .
#1 โ , ""
, exe', , PyInstaller:
if getattr(sys, 'frozen', False):
else:
#2 โ (, .)
Qt " ", rcc exe'. . icon.png src/resources/images, " " โ :/src/resources/images/icon.png. , . โ Qt' . .. - :
icon = QIcon(':/src/resources/images/icon.png')
. , , :
icon_file = open(':/src/resources/images/icon.png', 'rb')
icon = icon_file.read()
, open
, , .
Qt (, , , GUI Qt Designer .ui, loadUi
), - :
ui_file = QtCore.QFile(':/src/resources/images/icon.png')
ui_file.open(QtCore.QIODevice.ReadOnly)
data = ui_file.readAll()
ui_file.close()
ui_file = BytesIO(bytes(data))
, exe', - ? PyQt, , , . - ( PyInstaller). โ . ~40 (c -optimize-size
~35 ), - , .
ุนูุฏู
ุง ูุฌู
ุน ุงูุญุฏ ุงูุฃุฏูู ุงูุถุฑูุฑู ู
ู Qt ู PyQt ุ ุณูููู ู
ู ุงูุฌูุฏ ู
ุญุงููุฉ ุฅูุดุงุก ู
ูู exe ุจูุงุกู ุนูู ุงุณุชุฎุฏุงู
PyInstaller ุฃู cx_Freeze ูุฅููุงุก ูุธุฑุฉ ุนูู ุงูุญุฌู
ุ ูููู ูุฐู ุ ูู
ุง ูููููู ุ ูุตุฉ ุฃุฎุฑู ...