I've been writing a Tkinter program and I don't want the console to show, so I used a .pyw file. However the program ran with an error that said the program could run usr/bin/python3, so I removed the shebang line, and it worked, but do I need a shebang line? Or should I keep it as is.
Asked
Active
Viewed 124 times
1
-
Does it work with the shebang? -No. Does it work without it? -Yes. Do you need a shebang line? -Provided that it works without one, you probably don't. – ForceBru Apr 21 '19 at 19:17
1 Answers
1
If it works without the shebang line:
- Your computer found a version of Python to run it (likely in your "PATH" environment variables).
If it didn't work with the shebang line, either:
- You made a typo, or
- You gave it an incorrect path to your version of Python
Make sure you know exactly where Python is installed on your device:
(To anyone simply copy-pasting what you see in tutorials - without a good grasp of what it's doing: Try googling terms like "shebang line" and figure out what they might be doing behind the scenes)

Jonathan Rolfsen
- 53
- 13
-
I believe OP is asking about shebang for executing the file in background process (the way it works in Windows for `.pyw` files) – tejasvi88 Mar 23 '22 at 09:57