-2

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.

Emnm26
  • 1

2 Answers2

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