I work with linux on a servies. And I don't have the root privilege. I installed the python-3.2.3 locally to "/home/sam/install_sam". when I import the tkinter module. I get the following error:
ImportError: No module named _tkinter, please install the python-tk package
I know I need to install the Tkinter module. because I don't have the root privilege. I can't use like the following commands:
apt-get install python-tk
sudo apt-get install python-tk
And I search on goolge. I get tcl/tk from here. I install them use the following commands.
cd ~/Downloads/tcl8.5.11/unix
./configure --prefix=/home/sam/install_sam/tcl
make
make install
cd ~/Downloads/tk8.5.11/unix
./configure --prefix=/home/sam/install_sam/tk
--with- tcl=/home/sam/Downloads/tcl8.5.11/unix
make
make install
cd ~/Downloads/Python3.2.3/
export LD_LIBRARY_PATH=/home/sam/install_sam/tcl/lib:/home/sam/install_sam/tk/lib
export LD_RUN_PATH=/home/sam/install_sam/tcl/lib:/home/sam/install_sam/tk/lib
./configure --prefix=/home/sam/install_sam/python
make
make install
I still got error: INFO: Can't locate Tcl/Tk libs and/or headers. How should I config the tcl/tk for the python
Use CPPFLAGS environment variable to set the include directories for tcl and tk before building Python 3. This has worked for me.
export CPPFLAGS="-I/home/sam/install_sam/tcl/include -I/home/sam/install_sam/tk/include"