3

I'm really trying to run this simple .py file in QTerminal, but no matter what I try, I just can't get it to run. There's nothing special or complicated about the code in the file, it's just something simple.

Every time I try to run the file I get:-

Traceback (most recent call last):
     File "Tut1.py", line 3, in <module>
       from tkinter import *
ImportError: No module named tkinter

I'm certain I've properly installed Python 3 via:

sudo apt-get install python3-tk

And I've also verified the installation. I've also added:

#!/usr/bin/env python3

But that seems to have done nothing. I can use tkinter fine in Pycharm, but running the file in QTerminal just doesn't seem to work at all. Is there anything else I can try? I am using Lubuntu 19.10.

Thank you.

3

shakes head this is the second time I've answered my own question now :v

Instead of typing python Tut1.py into the QTerminal, I needed to type python3 Tut1.py. Now my little programs runs perfectly.

I am a dope.

|improve this answer|||||
  • Python != python. Commands are case-sensetive :) – N0rbert Mar 25 at 15:29
  • Very true. It wasn't case-sensitivity that was the problem, it was the missing 3 for python3. – Akendolfr Mar 25 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.