No module named _tkinter problem with Python's Tkinter library under Linux

Source: Internet
Author: User


The first step: first look at whether there is a tkinter module in Python, that is, find _tkinter.so, the following command:

sudo find/-name "*tkinter.so"

Step Two: If you can find the Tkinter module in Python and see the version information for _tkinter.so, use the following command:

Sudo Find/-name "libtk*"

My system is loaded with 8.5.

Then modify the setup.dist and use the following command:

Vim Modules/setup.dist

Find the following lines and remove the front #

_tkinter _tkinter.c tkappinit.c-dwith_appinit \

-l/usr/local/lib \

-i/usr/local/include \

-ltk8.5-ltcl8.5 \

-lx11

The above fourth line-ltk8.5-ltcl8.5 default is 8.2, my system loaded is 8.5, so changed to 8.5, save exit.

Recompile install Python.

Sudo./configure--enable-unicode=ucs4--enable-shared cxxflags=-fpic cflags=-fpic

Make–j8

Sudomake Install

Step three: If you can't find _tkinter.so, prove that there is no tkinter module in python, download Tcl and TK, URLs below.

Https://sourceforge.net/projects/tcl/files/Tcl

In the terminal, typing the following command to install TCL

Tar-zvxftcl8.4.4.tar.gz
CD tcl8.5.11/
CD UNIX
./configure
Make
Make install

In the terminal, typing the following command to install TK

TAR-ZVXF tk8.4.4.tar.gz
CD tk8.5.11/
CD UNIX
./configure
Make
Make install

See the specific steps: http://blog.sina.com.cn/s/blog_9011bd8c0101fvhu.html







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.