![]() |
Compile python project to single portable .exe file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Compile python project to single portable .exe file (/thread-6729.html) |
Compile python project to single portable .exe file - Campbell - Dec-05-2017 I would like compile python project to one exe file. I installed python 3.6, pygt5 and pyinstaller. I can run script with python interpreter using command 'python name.py' and compile scritpt to exe file using command 'pyinstaller --onefile name.py' But unfortunettly, when compiled file (exe file) is ran (by mouse click), also the console window appears. #!/usr/bin/python3 # -*- coding: utf-8 -*- from PyQt5.QtWidgets import QApplication, QWidget class Calculator(QWidget): def __init__(self, parent=None): super().__init__(parent) self.interfejs() def interfejs(self): self.resize(300, 100) self.setWindowTitle("Simple calculator") self.show() if __name__ == '__main__': import sys app = QApplication(sys.argv) window = Calculator() sys.exit(app.exec_())It is application with gui and I would like open only gui (without cmd window). . RE: Compile python project to single portable .exe file - buran - Dec-05-2017 https://pyinstaller.readthedocs.io/en/stable/usage.html#windows-and-mac-os-x-specific-options use Quote:-w, --windowed, --noconsole Windows and Mac OS X: do not provide a console window for standard i/o. On Mac OS X this also triggers building an OS X .app bundle. This option is ignored in *NIX systems. Also you may want to rename your file and use .pyw extension RE: Compile python project to single portable .exe file - Campbell - Dec-05-2017 (Dec-05-2017, 09:59 AM)buran Wrote: use Thanks, I have another question I also try compile greater project (electrum) and after 'pyinstaller --onefile --noconsole electrum' and run electrum.exe file in dist directory I got error: Quote:Traceback (most recent call last): (in the interpreter it starts correctly) in README file, I found following information: Quote:Development version i executed 'python setup.py install' and ' pyrcc5 icons.qrc -o gui/qt/icons_rc.py' but command 'protoc --proto_path=lib/ --python_out=lib/ lib/paymentrequest.proto' (fourth step in above instruction) is not recognized. I cannot use apt-get because I work on windows. 'pip install protobuf-compiler' doesnt work. How I can install "protobuf-compiler" and is it necessary to solve my problem ? RE: Compile python project to single portable .exe file - buran - Dec-05-2017 There are specific instructions for installation under windows - as an executable or from python source. The development version that is developed in linux? RE: Compile python project to single portable .exe file - Campbell - Dec-05-2017 (Dec-05-2017, 11:08 AM)buran Wrote: There are specific instructions for installation under windows - as an executable or from python source. But this "specific instruction" is totally unhelpful for me. In README file was written: Quote:Creating Binaries but the file "contrib/build-wine/README " does not exist ! RE: Compile python project to single portable .exe file - buran - Dec-05-2017 I refer to information from this link https://electrum.org/#download as to the contrib/build-wine/README that is for linux. wine allows to run windows programs on linux OS. the file is available in the github repo that you provide link for https://github.com/spesmilo/electrum/tree/master/contrib/build-winei.e. that is how to compile windows binary on linux machine |