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.
Related
for some reason i cant run a program that i have "compiled" using Pyinstaller.
I have used the following command to make the exe file:
pyinstaller -F logFileHandler.py
I have also tried:
pyinstaller -F --onefile --windowed logFileHandler.py
but that did not work either.
As i understand the -F and --onefile is more or less the same?
The error i get when i try to run the program is:
As far as i can see the problem is with Pandasgui
and it is looking for some weird theme..
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'm working on project where I am using Python/C API and C++. C++ is used for most part of application, mainly for gui (wxWidgets), while Python is used for calculations on large data sets, e.g. from files. I'm doing it in Visual Studio and when I run the project in IDE everything works fine, like I want it to. Also, the exe file that is created during the launch of the project in the visual studio, when it is in the same folder with the python .py file, also works as it should be. But what I want to achieve is a complete application contained in one exe.
While searching for a solution, I found various possibilities to create an exe from a python file. For example, PyInstaller which I tested for a simple "hello world" python file and it works. However, I don't know and can't find a solution how to combine the exe created in visual with a python file.
In PyInstaller github issues I found that line:
pyinstaller App.py --add-data 'pathtoexe\your.exe;.' --add-binary "pathtodll\your.dll;." --onefile --noconsole --clean
And I typed this into the console:
pyinstaller myPythonFile.py --add-data 'myVisualGeneratedFile.exe;.' --onefile --noconsole --clean
But after that, when I clicked generated exe file, nothing happens.
I hope that someone has done a similar thing before and I can find help here because I'm already losing my mind on it.
According to https://pyinstaller.readthedocs.io/en/stable/usage.html, you should use --add-binary and not --add-data.
I tried to convert my python gui application (.py ) to an executable file(.exe) using the pyinstaller module. I ran the following command in the terminal -
pyinstaller.exe --onefile -w sourcecode.py
The process was completed successfully and I got the .exe file(sourcecode.exe) along with the extra folders like pycache and sourcecode. But when I tried to run the .exe file/application by double clicking on it the app didn't start up and gave an error. Please help.
Try adding this --hidden-import to pyinstaller.exe --onefile -w sourcecode.py in case of hidden modules.
You can also try adding --debug to see what the error actually is.
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.