Sam*_*uel 10 python linux tk-toolkit tkinter tcl
我在服务器上使用linux.我没有root权限.我在本地安装了python-3.2.3到"/ home/sam/install_sam".当我导入tkinter模块.我收到以下错误:
ImportError: No module named _tkinter, please install the python-tk package
Run Code Online (Sandbox Code Playgroud)
我知道我需要安装Tkinter模块.因为我没有root权限.我不能像下面的命令一样使用:
apt-get install python-tk
sudo apt-get install python-tk
Run Code Online (Sandbox Code Playgroud)
我在goolge上搜索.我从 这里得到tcl/tk.我安装它们使用以下命令.
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
Run Code Online (Sandbox Code Playgroud)
我仍然有错误:INFO:找不到Tcl/Tk库和/或标题.我应该如何为python配置tcl/tk
最后.我在同一路径中安装tcl/tk和python.它现在可以工作了.命令如下:
cd ~/Downloads/tcl8.5.11/unix
./configure --prefix=/home/sam/install_sam/python3
make
make install
cd ~/Downloads/tk8.5.11/unix
./configure --prefix=/home/sam/install_sam/python3
--with-tcl=/home/sam/Downloads/tcl8.5.11/unix
make
make install
export LD_LIBRARY_PATH=/home/sam/install_sam/python3/lib
cd ~/Downloads/Python3.2.3/3
./configure --prefix=/home/sam/install_sam/python3
make
make install
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我如何以第一种方式为python配置tcl/tk(在问题中提到).我会很感激的
在构建Python 3之前,使用CPPFLAGS环境变量来设置tcl和tk的include目录.这对我有用.
export CPPFLAGS="-I/home/sam/install_sam/tcl/include -I/home/sam/install_sam/tk/include"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10771 次 |
| 最近记录: |