您的位置:首页 > 编程语言 > Python开发

如何通过源码文件编译安装wxpython

2013-08-18 17:00 525 查看
part 1:首先安装wxGTK

1.解压wxGTK文件:

$ tar -xvzf wxGTK-2.2.5.tar.gz


2.进入目录:

$ cd wxGTK-2.2.5

3.运行configure脚本:

$ ./configure --with-gtk


如果没有安装GTK或GTK的头文件在这里就会出错:(参考:gtk+-devel-1.2.8-6mdk.i586.rpm  http://www.wxwidgets.org/)
4.运行make文件:

$ make


如果没有安装lex或者yacc这里会报错(参考: the right rpms are byacc-1.9-7mdk.i586.rpm and flex-2.5.4a-13mdk.i586.rpm)

5.这时的安装需要超级用户模式:

$ su
# make install


6.链接函数库:

# ldconfig


7.退出超级用户:

# exit


8.进入目录并与安装文件建立符号链接:

$ cd /usr/lib
$ ln -s /usr/local/lib/libwx_gtk.so


wxGTK安装完毕

part 2:

1.解压文件:

$ tar -xvzf wxPython-2.2.5.tar.gz


2.进入目录:

$ cd wxPython-2.2.5


3.编辑setup.py文件,选择需要安装的选项,在选择的时候这里建议不要安装OGL和GL_CANVAS:

BUILD_GLCANVAS = 0 # If true, build the contrib/glcanvas extension module
BUILD_OGL = 0      # If true, build the contrib/ogl extension module
BUILD_STC = 1      # If true, build the contrib/stc extension module
CORE_ONLY = 0      # if true, don't build any of the above
GL_ONLY = 0        # Only used when making the -gl RPM.  See the "b" script
# for the ugly details
USE_SWIG = 0       # Should we actually execute SWIG, or just use the
# files already in the distribution?
IN_CVS_TREE = 0    # Set to true if building in a full wxWidgets CVS
# tree, otherwise will assume all needed files are
# available in the wxPython source distribution


4.建立python模块:

$ python setup.py build


5.进入超级用户安装该模块:

$ su
# python setup.py install


6退出超级用户,检查模块是否安装成功:

# exit
$ python
Python 1.5.2 (#1, Sep 30 2000, 18:08:36)  [GCC 2.95.3 19991030 (prerelease)] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import wx
>>>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息