I developing a GUI app in Python, the code works fine in PyCharm IDE. Now I want to convert into an exe for distribution.
My code works fine until I generate a single file exe with PyInstaller with -w option enable (command: pyinstaller -F -w ). If I omit -w option, the code works fine but the final exe shows unwanted console as well.
To find a solution, I searched and found this to be a suitable workaround:
Python Subprocess Popen with Pyinstaller
Therefore, I tried Recipe sub-process as described here:
https://github.com/pyinstaller/pyinstaller/wiki/Recipe-subprocess
However, this is not working for me and I still get the error where subprocess command fails.
Anybody been in this situation, please help.
I am using Python 3.5, PyInstaller version 3.2.1.
Related
I programmed a small application and compiled it using pyinstaller. However I can't run my compiled .exe. It shows this error:
Does anyone know how to fix it and create a working .exe?
pyinstaller --noconfirm --onedir --windowed --icon " "
I had the exact same problem. For me it turned out to be a bug related to pyinstaller 4.7 and python 3.9.8. I uninstalled python 3.9.8 and installed 3.9.5 instead and it worked perfectly with pyinstaller -w, my exe file runs without a console window now, and without any errors.
This happens because of --windowed argument in Windows. Without it it compiles and works ok, but you need to keep the Command Prompt window open too. Still trying to find a work-around.
I cannot generate my setup with pyInstaller. When I type command "pyinstaller -w -F myfile.py" here is error below:enter image description here
This question needs more clarity/ detail. You should check that you have properly installed pyinstaller and python and that your python code runs without errors. If it still does not work, you can try running the same command on a different OS (e.g. on a Windows PC if possible)
I have written some code in python. It is working fine from command prompt. So, I have tried to create .exe application using pyinstaller. The command i used is:
pyinstaller --onedir --windowed Result_generator.py
The app is build successfully. But, when I open it, it is showing an error saying "Fatal Error" and was unable to execute it. It immediately shuts down when i open it. But the same code works fine using command prompt execution. Please help me with this. Thanks in advance!
Doubt:
I am using xlsxwriter package. Does it effect the application? Does pyinstaller work with python 3.6.4?
I'm trying to generate an executable from Linux for Windows using pyinstaller.
pyinstaller --onefile --windowed montecarlo.py
I run this command and get a single executable that works on Linux just fine, but if I try on Windows, it's just a simple file. Why?
I was trying to do this same thing today and ran across this answer. It pointed to the FAQ, which says cross-compiling is not supported. It recommends using Wine.
So far I have used cx_freeze to convert .py file to .exe file, but I get many files. Is there a way to get it all into one executable?
I have seen that PyInstallerGUI is able to that, but it is for Python 2.7. Can it be done with Python 3.4 as well?
PyInstaller works up to Python 3.5. Once you've installed it (type in your terminal pip install pyinstaller), you can do in your terminal:
pyinstaller --onefile script.py
where script.py is the name of script you want to compile into .exe
With the --onefile option it will create only one .exe file.
I haven't tried it but, PyInstaller says here it can do that and it supports Python 2.7 and Python 3.3+.
Quoting from the linked page:
PyInstaller can bundle your script and all its dependencies into a
single executable named myscript (myscript.exe in Windows).
The advantage is that your users get something they understand, a
single executable to launch. A disadvantage is that any related files
such as a README must be distributed separately. Also, the single
executable is a little slower to start up than the one-folder bundle.
Before you attempt to bundle to one file, make sure your app works
correctly when bundled to one folder. It is is much easier to diagnose
problems in one-folder mode.
I found this in the PyInstaller documentation:
pyinstaller --onefile your-python-file.py
To find more: PyInstaller documentation