Bonjour j'ai installé tkinter pour python 3 mais le module reste introuvable dans mon code :
j'ai installé tkinter avec la commande suivante : sudo apt-get install python3-tk
ma version de python est la suivante : Python 3.11.3
et ce code ne fonctionne pas :
il me renvoit cette erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #!/usr/bin/env python3 # -*- coding utf-8 -*- from tkinter import * def main(): root = tk.Tk() root.title("Fenêtre de base chez Pythonia") label = tk.Label(root, text="Bienvenue dans Tkinter!") label.pack() root.mainloop() if __name__ == "__main__": main()
Merci de m'aider a faire fonctionner tkinter avec python 3Traceback (most recent call last):
File "/home/thib/Desktop/calculatrice_Tkinter/./calculate_tkinter.py", line 4, in <module>
import tkinter
File "/usr/local/lib/python3.11/tkinter/__init__.py", line 38, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_tkinter'
Bien a vous.
EDIT : c'est bon j'ai trouvé il fallait simplement installer la dernier version de python la 3.14 via le site officiel.









Répondre avec citation
Partager