In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
When you see the graphical interface programming, you need to import the Tkinter module to import Tkinter in the interpreter, and then. The error is as follows:
> from tkinter import * Traceback (most recent call last): File "", line 1, in File "/ usr/local/lib/python2.7/tkinter/__init__.py", line 39, in import _ tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _ tkinter
From the point of view of the error message, there was an error during import and the tkinter module was not found, mainly because the Tk was not configured when compiling python.
Solutions are as follows:
Query the tk package installed in the operating system:
Rpm-qa | grep ^ tk # indicates to query the installation package that begins with tk
As a result, only one tk package was installed, thus missing a tk-devel installation package that was not installed.
Thus, you need to install the tk-devel package, as shown below: (you can also use other methods to install, such as rpm installation, but yum is the most convenient)
Copy
Yum-y install tk-devel # install tk-devel installation package
After installation, you must recompile python
Copy
1. / configure-- prefix=/usr/local/python 2 make & & make install
Test: import the module directly without any errors.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.