I am using Git Bash to run some code involving Tkinter, but have been unable to run the code and have gotten the error ModuleNotFoundError: No module named 'Tkinter'. I have #!/usr/bin/env/python3 as the first line of my code, but this does not seem to help. When i type import Tkinter and import tkinter into my bash line, it returns with bash: import: command not found. When I attempt to use sudo, it responds with bash: sudo: command not found. I am not sure what to do at this point, as I have already reinstalled both git bash and python and neither seem to help.
Asked
Active
Viewed 350 times
-2
-
https://stackoverflow.com/questions/20044559/how-to-pip-or-easy-install-tkinter-on-windows – Gunesh Shanbhag Jun 21 '20 at 16:51
-
Does this answer your question? [How to pip or easy\_install tkinter on Windows](https://stackoverflow.com/questions/20044559/how-to-pip-or-easy-install-tkinter-on-windows) – Gunesh Shanbhag Jun 21 '20 at 16:51
-
2With python3 it's `tkinter`, not `Tkinter`. – Bryan Oakley Jun 21 '20 at 16:55
-
As stated above, I have tried both tkinter and Tkinter. – Emnm26 Jun 21 '20 at 17:29
-
I also appreciate the recommendation to pip install, but I have tried this as well and it does not work either. – Emnm26 Jun 21 '20 at 17:31
-
@Emnm26 ***#!/usr/bin/env/python3***: What gives `which python3`? – stovfl Jun 21 '20 at 17:50
-
Command `env` is used like `/usr/bin/env python3` (space between env and python3). Also import is not a bash command. Use the OS package manager to check whether tkinter package is installed or not. – acw1668 Jun 22 '20 at 00:31
-
"As stated above, I have tried both tkinter and Tkinter" - Yes, but you tried them **as bash commands, not as Python code**. – Karl Knechtel Apr 29 '23 at 01:56
2 Answers
0
Python's import
statement is case sensitive, so it just might work if you write import tkinter
instead of import Tkinter
.
The reason some some tutorials use the latter is because that's how it used to be in python 2. It wasn't considered very pythonic however, since all package and module names should be lowercase, so it was changed in python 3.

joelhed
- 60
- 6
-
Thank you very much for the recommendation, but I have tried both the uppercase and lowercase versions and neither worked. – Emnm26 Jun 21 '20 at 17:22
0
Regarding the first error message joelhed's anwser should solve your problem.
You receive the second error message because you
can't directly run python commands in the bash line.
To run python commands in the command line run python
first.

Lcj
- 371
- 3
- 10
-
Thank you very much for the comment, but I have tried putting python and python3 before the code I was running and it still stopped when attempting to import tkinter. – Emnm26 Jun 21 '20 at 17:24