Solution | ModuleNotFoundError | No Module Error: While converting .py files to .exe using PyInstaller. #145834
Unanswered
AtharvaBallal
asked this question in
General
Replies: 1 comment
-
Hey, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
General
Body
Today, I want to share my experience with resolving the "ModuleNotFoundError" while converting a Python script into an executable.
I developed a desktop application in Python using Tkinter and several other modules. My goal was to package it as a standalone executable so others could use it without installing any dependencies.
To achieve this, I used PyInstaller and ran the following command in the Command Prompt from the directory containing my Python file. Unfortunately, this resulted in a "ModuleNotFoundError" and the build failed.
The Command I used: pyinstaller --onefile --noconsole file.py
CMD Output:
Error Screenshot:
Solution That Worked for Me
After trying multiple approaches, the method that resolved this issue was simple:
I ran the same PyInstaller command from the IDE's integrated terminal instead of the Command Prompt, and It worked for me.
If you encounter the same error, I recommend executing the PyInstaller command in your IDE's terminal.
Beta Was this translation helpful? Give feedback.
All reactions