Solve problems related to "ImportError: No module named _ tkinter" in centos
Today, when you want to use Metasploit"ImportError: No module named _ tkinter"
Error,_ Tkinter
YesTkinter
The module referencesTkinter
I am not familiar with it, so I don't know why this error occurs.
I am in centos, and different accounts in the system use different versions of Python, so I tried it under the root account first.Import Tkinter
Is OK, and then use the commandImport _ tkinter;
Printed_ Tkinter
The file path is found in the directory "/usr/lib64/python2.7/lib-dynload/" and is the so file.
First, I want to directly copy _ tkinter. so under the root account to Python lib-dynload under the xxuser account, but I find thatUndefined symbol: PyUnicodeUCS4_AsUTF8String
The error is caused by different Python compilation parameters between root and xxuser. It seems that this method is not feasible.
Then I found a circle on the Internet and did not find that I could install it directly._ Tkinter
Later, I thought about whether the _ tkinter. so was generated during Python compilation? So I downloaded a Python source code consistent with the current Python version of xxuser.-- Enable-unicode = ucs2
, Re-./Configure, make
After the build/lib. linux-x86_64-2.7 directory does generate the _ tkinter. so, and then copy _ tkinter. so to Python lib-dynload of xxuser account, runImport Tkinter
OK.