Suse10 64位环境下配置Tkinter and Pmw

前言:需要将现有的话单程序移植到SUSE10下,并调用华为的话单加密算法。于是乎开始搭建

可恶的调试环境,整个过程搭建10个小时之多,遂忙记录下这个过程,避免后人循规蹈矩。

首先,在SUSE10,软件管理工具中安装:

tcl-devel

tk-devel

Package包,安装完成后使用以下命令查看安装是否成功:

linux89:/AntiSpam/software/linux/Python-2.5.2 # rpm -qa | grep tcl
tcl-devel-8.4.12-16.2
tcl-8.4.12-16.2
itcl-32bit-3.3-437.2
itcl-3.3-437.2
tclx-8.4-345.2
tcl-32bit-8.4.12-16.2

linux89:/AntiSpam/software/linux/Python-2.5.2 # rpm -qa | grep ^tk
tk-devel-8.4.12-14.12
tk-8.4.12-14.12
tk-32bit-8.4.12-14.12

http://www.python.org/官方站点下载:

Source Distribution 笔者使用的版本为:Python-2.5.2.tar.bz2

Pmw 笔者使用的版本为:Pmw.1.3.2.tar.gz

使用WinSCP工具,使用root帐户,上传至任意目录

开始安装Python-2.5.2:

1、解压Python编译包:tar -jxvfPython-2.5.2.tar.bz2

2、进入Python路径:cd Python-2.5.2

3、修改Python-2.5.2/Modules/Setup.dist文件,将以下部分开启

# The _tkinter module.
#
# The command for _tkinter is long and site specific. Please
# uncomment and/or edit those parts as indicated. If you don't have a
# specific extension (e.g. Tix or BLT), leave the corresponding line
# commented out. (Leave the trailing backslashes in! If you
# experience strange errors, you may want to join all uncommented
# lines and remove the backslashes -- the backslash interpretation is
# done by the shell's "read" command and it may not be implemented on
# every system.

# *** Always uncomment this (leave the leading underscore in!):
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
-L/usr/local/lib \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
-I/usr/local/include \
# *** Uncomment and edit to reflect where your X11 header files are:
-I/usr/X11R6/include \
# *** Or uncomment this for Solaris:
-I/usr/openwin/include \
# *** Uncomment and edit for Tix extension only:
#-DWITH_TIX -ltix8.1.8.2 \
# *** Uncomment and edit for BLT extension only:
#-DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
# *** Uncomment and edit for PIL (TkImaging) extension only:
# (See http://www.pythonware.com/products/pil/ for more info)
#-DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
# *** Uncomment and edit for TOGL extension only:
#-DWITH_TOGL togl.c \
# *** Uncomment and edit to reflect your Tcl/Tk versions:
#-ltk8.2 -ltcl8.2 \
# *** Uncomment and edit to reflect where your X11 libraries are:
#-L/usr/X11R6/lib \
# *** Or uncomment this for Solaris:
#-L/usr/openwin/lib \
# *** Uncomment these for TOGL extension only:
#-lGL -lGLU -lXext -lXmu \
# *** Uncomment for AIX:
#-lld \
# *** Always uncomment this; X11 libraries to link with:
#-lX11
4、使用make命令,进行编译

5、使用sudo make install,进行安装

6、确认Tkinter是否安装成功:

Step 1 - can _tkinter be imported?

Try the following command at the Python prompt:

>>>import_tkinter#withunderscore,andlowercase't'

  • If it works, go to step 2.
  • If it fails with "No module named _tkinter", your Python configuration needs to be modified to include this module (which is an extension module implemented in C). Do **not** edit Modules/Setup (it is out of date). You may have to install Tcl and Tk (when using RPM, install the -devel RPMs as well) and/or edit the setup.py script to point to the right locations where Tcl/Tk is installed. If you install Tcl/Tk in the default locations, simply rerunning "make" should build the _tkinter extension.
  • If it fails with an error from the dynamic linker, see above (for Unix, check for a header/library file mismatch; for Windows, check that the TCL/TK DLLs can be found).

Step 2 - can Tkinter be imported?

Try the following command at the Python prompt:

>>>importTkinter#nounderscore,uppercase'T'

  • If it works, go to step 3.
  • If it fails with "No module named Tkinter", your Python configuration need to be changed to include the directory that contains Tkinter.py in its default module search path. You have probably forgotten to define TKPATH in the Modules/Setup file. A temporary workaround would be to find that directory and add it to your PYTHONPATH environment variable. It is the subdirectory named "lib-tk" of the Python library directory (when using Python 1.4 or before, it is named "tkinter").

检查Python是否运行正常:

linux89:/AntiSpam/software/linux/Python-2.5.2 # python
Python 2.5.2 (r252:60911, Sep 18 2008, 19:17:58)
[GCC 4.1.2 20070115 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

linux89:/AntiSpam/software/linux/Python-2.5.2 # python
Python 2.5.2 (r252:60911, Sep 18 2008, 19:17:58)
[GCC 4.1.2 20070115 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _tkinter
>>>

若出现安装问题,请联系:[email protected]

或者QQ:185802862

MSN:[email protected]

你可能感兴趣的:(linux,python,配置管理,SuSE,Tcl)