After I compile myfile.py to exe with pyinstaller to one file, that file is working on my computer but not on others' computers.
error >>> Failed to execute script Myfile
I use this command
pyinstaller --onefile Myfile.py
Build your exe with --debug=all and run it in a console. Provide the output to help people help you.
Refer to https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html#getting-debug-messages to get more details if needed
Related
I ran the command pyinstaller --onefile -w file.py. It worked, so like any other person I instantly went to test it. But when I ran it it gave me a error saying failed to execute script file inside of a windows error message. I went to run the python script and it worked. I tried to run it with the console by running the command pyinstaller --onefile file.py and it gave me the same issue.
If you run the bundled application (not the script) from the console like file.exe on Windows or ./dist/file on Ubuntu you will see the actual source of the issue in the console. This will help you to resolve it.
I used docker because It was build exe from mac os. see more https://hub.docker.com/r/cdrx/pyinstaller-windows
[So I have previously used nuitka to create standalone executables for my python scripts and had no issue until this time I tried once again]
I am trying to use nuitka to create a .exe file for my .py script however, it throws the following error:
Nuitka:INFO: Starting Python compilation.
__main__.py: can't open file 'MyPythonProgram.py'.
I have given the following command in the command prompt (run as administrator and in the correct directory):
nuitka --mingw --follow-imports MyPythonProgram.py
I have also tried using --onefile --windows-onefile-tempdir and standalone however the result was the same.
I am using python 3.9.4 and nuitka 0.6.14.4. (Same as last time when it actually worked without throwing any errors)
So let me know, what went wrong with my attempt and how to fix it...
Thanks in advance!
I had built a simple program with minimalistic code
Code
and converted it into a .exe file using command prompt after which it refused to boot after I opened the .exe file in Visual Studio after which it prompted this
and allowed it to fix some errors then I saw some changes in the program, But then when I tried to open it, This showed up
and so is there a way to make the program boot and run and do I need additional code to make the program run?
Easy-peasy solution.
Do pip install pyinstaller and then from run pyinstaller --onefile filename.py
I have two Python scripts which produces a GUI and runs code off some of the buttons. When run from Python, I run mainImpactTool.py which then runs impactTool.py to produce the GUI.
mainImpactTool.py
impactTool.py
I followed the guidance here:
https://pythonhosted.org/PyInstaller/usage.html#what-to-bundle-where-to-search
So I could create a single executable for running on Windows.
If I had one script I would normally run:
Pyinstaller --onefile mainImpactTool.py
However, to use two scripts, I did this:
Pyinstaller --onefile mainImpactTool.py impactTool.py
Pyinstaller works, but when I run the .exe file I get the error:
ImportError ... Failed to execute script mainImpactTool
Any suggestions on what I am doing wrong?
Thank you
Pyinstaller --onefile mainImpactTool.py
Try this it will work. Pyinstaller will recurse over all your imports(impactTool.py) and include it in the .exe.
I have coded a program in Python 3.5 that uses the Tkinter import. I'm trying to figure out a way to run it on computers that don't have Python. First I tried freezing it but I haven't been able to because none of the freezing tools I found support Python 3.5. Then I tried possibly using a online idle but I couldn't find any that support Tkinter. I would prefer to be able to get a .exe file or something similar but if I could run it online that would be good too any ideas?
EDIT
So I have now successfully downloaded PyInstaller using pip. My current problem is when I type this into the console: pyinstaller.exe --onefile --windowed Finder.py
I get this error: 'pyinstaller.exe' is not recognized as an internal or external command,
operable program or batch file.
EDIT
I have now found the pathway to pyinstaller.exe. Now when I try to use it it says Access is denied.
I finally figured it out after about three days of work. Fist I downloaded PyInstaleller in the zipped form and extracted it. Then I put my program in the PyInstaller folder. Then I opened a regular command prompt. I then typed cd then the location of the PyInstaller folder. Finally I typed pyinstaller.py --one file --windowed program.py. Then when I went into the PyInstaller folder there was a folder called program with the .exe file in the dist folder. Thanks everyone for all of your help!
You can use pyinstaller to do that. I think its work fine on linux em linux.
Another option is use py2exe.
Try pyinstaller -F -w Finder.py as the command or you could check out CxFreeze.