skip to Main Content

I am brushing up on my python and as a a part of that I wanted to relearn tkinter. I am running into an issue where whenever I try to run the code through vscode it wont let me and it gives me a module not found error. I know that it is not an issue with my code since when I use a separate terminal it runs fine. I would deal with this but my terminal is constantly closing with no apparent reason. If I try to install tkinter on vscodes terminal it says that the module doesn’t exist

To install it I ran: pip install python3-tkinter

I got the errors: ERROR: Could not find a version that satisfies the requirement python3-tkinter (from versions: none)

ERROR: No matching distribution found for python3-tkinter

I am running fedora 40 and I am using the interpreter that vscode says is recommended which is python 3.11.9 64-bit in /bin/python3

2

Answers


  1. In the python installation screen, you can select tcl/tk in the optional features, which will install the corresponding version of tkinter for you.

    enter image description here

    tkinter cannot be installed by pip. You could use command sudo dnf install python3-tkinter in Fedora.

    Login or Signup to reply.
  2. To fix Tkinter issues on Fedora, use sudo dnf install python3-tkinter instead of pip. Also, in VSCode, select the correct Python interpreter via the Command Palette (Ctrl+Shift+P) and Python: Select Interpreter.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search