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