Problems encountered in python development and corresponding solutions

问题:ModuleNotFoundError: No module named ‘_tkinter’

The Tkinter module ("Tk interface") is the interface of Python's standard Tk GUI toolkit. It is a built-in module of Python and can be used directly by importing tkinter. If you encounter the above error, you need to manually install the corresponding module

  • Installation scheme in python2:
sudo apt-get update
sudo apt-get install python-tk
  • Installation scheme in python3:
sudo apt-get update
sudo apt-get install python3-tk
  • Check whether the installation is successful (after the installation is successful, enter the following command will have output):
dpkg --list | grep python3-tk

Guess you like

Origin blog.csdn.net/QLeelq/article/details/114131198