Ubuntu ImportError: No module named ‘_tkinter‘问题解决方式

 尝试安装`tkinter`模块.出现以下问题

sudo pip3 install tkinter
[sudo] password for Ns3: 
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
WARNING: The directory '/home/Ns3/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
ERROR: Could not find a version that satisfies the requirement tkinter
ERROR: No matching distribution found for tkinter

解决方式

sudo apt-get install python3-tk

安装成功后运行代码,可以正常运行

你可能感兴趣的:(python,开发语言)