In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.