Solve problems related to "ImportError: No module named _ tkinter" in centos

Source: Internet
Author: User

Solve problems related to "ImportError: No module named _ tkinter" in centos
Today, when you want to use Metasploit"ImportError: No module named _ tkinter"Error,_ TkinterYesTkinterThe module referencesTkinterI 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 TkinterIs OK, and then use the commandImport _ tkinter;Printed_ TkinterThe 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_AsUTF8StringThe 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._ TkinterLater, 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, makeAfter 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 TkinterOK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.