Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What if vscode cannot load tkinter?

Shulou Source: shulou.com Published: 2022-06-02 18:05:19 09月30日 Update

This article mainly introduces vscode can not load tkinter how to do, the article is very detailed, has a certain reference value, interested friends must read it!

After learning Python to configure VScode, I encountered some problems after installing easygui.

The code is as follows:

Import easyguieasygui.msgbox ("Hello world.")

Ctrl+Shift+B, the error is reported as follows:

Traceback (most recent call last): File "/ usr/lib/python3.5/tkinter/__init__.py", line 36, in import _ tkinterImportError: No module named'_ tkinter'During handling of the above exception, another exception occurred:Traceback (most recent call last): File "/ home/hongludianxue/.local/lib/python3.5/site-packages/easygui/boxes/utils.py", line 29, in import tkinter as tk # python3 File "/ usr/lib/python3.5/tkinter/__init__.py" Line 38, in raise ImportError (str (msg) +', please install the python3-tk package') ImportError: No module named'_ tkinter', please install the python3-tk packageDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "/ home/hongludianxue/.local/lib/python3.5/site-packages/easygui/boxes/utils.py", line 36, in import Tkinter as tk # python2ImportError: No module named 'Tkinter'During handling of the above exception Another exception occurred:Traceback (most recent call last): File "/ home/hongludianxue/.local/lib/python3.5/site-packages/easygui/boxes/button_box.py", line 15, in from. Import utils as ut File "/ home/hongludianxue/.local/lib/python3.5/site-packages/easygui/boxes/utils.py", line 43, in raise ImportError ("Unable to find tkinter package.") ImportError: Unable to find tkinter package.During handling of the above exception, another exception occurred:Traceback (most recent call last): File "/ home/hongludianxue/Documents/Python file/0x00.py", line 1 In import easygui File "/ home/hongludianxue/.local/lib/python3.5/site-packages/easygui/__init__.py", line 34, in from .boxes.button _ box import buttonbox File "/ home/hongludianxue/.local/lib/python3.5/site-packages/easygui/boxes/button_box.py", line 18, in import global_stateImportError: No module named 'global_state'

I didn't know until I saw ImportError: No module named'_ tkinter' that there was no tkinter module.

Install tkinter in the terminal:

Sudo apt-get install python3-tk

After running the Python code before it is finished, it is found that it has been run successfully.

These are all the contents of the article "what if vscode can't load tkinter". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Run what to do code content articles success value interest done guys partners more modules knowledge terminals industry information information channels questions channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Linux vpn Shulou Information MariaDB