I am trying to compile a complex script into an exe with PyInstaller, this is the install command I am currently using although I have tried many variations of these flags:
pyinstaller -w -F --debug=all --noupx --name godnesssakes .\uhoh.py
When I run the exe from the command line I get no output whatsoever, even with debug mode enabled:
Even after simplifying my python script to a simple print command I am still getting no output:
def main():
print('test')
main()
I have tried everything including reinstalling python, reinstalling pip, verifying path, verifying no conflicting versions, using --path flag in pyinstaller...
Versions:
- Python 3.9.9
- Pyinstaller 5.4.1
Answers that have NOT helped:
- Pyinstaller, .exe file does nothing
- Pyinstaller EXE file does nothing
- Pyinstaller generating EXE that does nothing
- PyInstaller .exe file does nothing
CodePudding user response:
Follow each of these steps... or use your operating system's equvalent.
mkdir newdir
andcd newdir
py -m venv venv
andvenv\Scripts\activate
py -m pip install --upgrade pip pyinstaller
- copy your script into the
newdir/main.py
To make it even more obvious:....
def main():
while True:
print('test', end='\r')
main()
pyinstaller -F --debug=all --noupx --name goodnesssakes main.py
dist\goodnesssakes.exe
The actual problem is that you are using the -w
flag which tells pyinstaller that it is a windowed application and therefore doesn't output anything to the console. It is literally and alias for --noconsole
CodePudding user response:
filename in cmd is incorrect, it's "goodnesssakes.exe" not "godnesssakes.exe" .
Thank you