1. Preface
This article mainly describes in the Linux environment to compile Wxpython, install Wxpython under Windows is very simple, as long as the download, and then directly execute EXE file, the next step can be installed, under Linux, there are many steps.
Wxpython Download Address is:
http://wxpython.org/download.php
Specific source download path in the bottom of the location, the name is WXPYTHON-SRC, click to download. The file name you downloaded is wxpython-src-3.0.2.0.tar.bz2.
2, decompression
To unpack:
[Root@ftp ~]# TAR-JXVF wxpython-src-3.0.2.0.tar.bz2
3, install the dependent package
Gtk2,gtk2-devel,python-devel,tk,tk-devel,gstreamer,gstreamer-devel,mesa-libgl-devel,
Mesa-libglu-devel,mesa-libglu,mesa-libgl,libsm,libsm-devel,gstreamer-plugins-base-devel
It is best to use yum for installation. Or it'll crash.
4, compile
Create a new temporary path to save the results of the compilation, as follows:
[Root@ftp wxpython-src-3.0.2.0]# mkdir bld
[root@ftp wxpython-src-3.0.2.0]# cd bld
[Root@ftp bld]#]. /configure--prefix=/usr/local/pythonwxpython--WITH-GTK--with-gnomeprint
--with-opengl--enable-debug--enable-geometry--enable-graphics_ctx--enable-sound--with-sdl
--enable-mediactrl--enable-display--disable-debugreport--enable-unicode--with-libjpeg=builtin
--with-libpng=builtin--with-libtiff=builtin--with-zlib=builtin
New BLD to save the results of the compilation, mainly because of the time of compilation, occupy more than 1G of space, so need to use a new directory to compile, note that the top configure in front of two points.
The results of the compilation are as follows:
To install:
Make && make install
The time consumed and the space taken up are as follows:---------compilation takes 8 minutes, the server is expected to be much faster
[Root@ftp local]# df-h
filesystem Size Used avail use%
mounted on/dev/mapper/vg_ftp-lv_root
9.9G 6.1G 3.3G 66%/
tmpfs 387M 0 387M 0%/dev/shm
/dev/sda1 485M 32M 428M 7%/boot
[root@ftp local]# date
Tue Apr 5 13:07:07 EDT 2016
[root@ftp local]# Date
Tue Apr 5 13:14:56 EDT 2016
[root@ftp local]# df-h
filesystem Size Used Avail use% mounted on
/dev/mapper/vg_ftp-lv_root
9.9G 8.1G 1.3G 87%/
Tmpfs 387M 0 387M 0%/dev/shm
/dev/sda1 485M 32M 428M 7%/boot
Installation Wxpython:--wx_config is the path to the previous compilation configure
[root@ftp wxpython]# python setup.py build_ext--inplace--debug wx_config=/usr/local/pythonwxpython/bin/wx-config
After installation, set the WXPYTHON environment variable:
Export pythonpath= "/usr/local/wxpython"
export ld_library_path= "/usr/local/pythonwxpython/lib
Can be added to the user plus directory, and Wxpython must be added to the Pythonpath as follows:
[Root@ftp wxpython-src-3.0.2.0]# cp-r wxpython/usr/local/wxpython/
Copy is mainly to correspond to the above Pythonpath problem 1, recompile
When recompiling, you must first clear the previously compiled file and use the following command:
Make Distclean
If you use Makeclean, it is not possible, the error message is as follows:
Configure:error:source directory already configured; Run "Make Distclean" there the
configure:error:.. /.. /.. /src/tiff/configure failed for Src/tiff
If the above command can not be cleared, then the decompression to compile the bar 2, import WX module error
An error occurred while importing the WX module with the following error contents:
>>> Import WX
traceback (most recent):
File "<stdin>", line 1, in <module>
Fil E "wx/__init__.py", line, in <module>
wx._core import *
File "wx/_core.py", line 4, in <module> ;
Import _core_
Importerror:libwx_gtk2u_xrc-3.0.so.0:cannot Open Shared object file:no such file or directory
Set environment variable Ld_library_path:
[Root@ftp wxpython]# cat ~/.bash_profile |grep LD
export ld_library_path= "/usr/local/pythonwxpython/lib
The environment variable is written in the user file, which can be used directly each time. 3. WX module cannot be imported on another path
When another path is imported to the WX module, the error is as follows:
[root@ftp ~]# python
python 2.7.11 (default, APR 5 2016, 12:30:11)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on L inux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>> Import WX
traceback (most recent):
File "<stdin>", line 1, in <module>
Imp Orterror:no module named WX
The main is to add Wxpython to the search path of the module, as long as the environment variable can be modified, as follows:
[Root@ftp wxpython-src-3.0.2.0]# cp-r wxpython/usr/local/wxpython
[root@ftp wxpython-src-3.0.2.0]# cat ~/.bash_ Profile |grep PYTHON
export pythonpath= "/usr/local/wxpython"
4, error GTK not found
The specific error content is as follows:
Could not run GTK + test program, checking why
... The test program failed to compile or link. The file Config.log for the
* * * exact error that occured. This usually means GTK + is incorrectly installed.
Configure:error: The
development files for GTK + were not found. For GTK + 2, please ensure that pkg-config are in the path and the
gtk+-2.0.pc is
installed. For GTK + 1.2 Please check this gtk-config is in the path, and this
version is 1.2.3 or above. Also Check that this
libraries returned by ' Pkg-config gtk+-2.0--libs ' or ' gtk-config--libs ' are in the
Ld_librar Y_path or equivalent.
Mainly to see if the GTK2 and Gtk2-devel packages are installed, install these two packages can
Some people say that you need to install the Pkgconfig package, this package has been installed in this system, so no testing. 5, error Gstream not found
The specific error content is as follows:
Configure:no package ' gstreamer-1.0 ' found Configure:error:no gstreamer-1.0 >= 1.0.0
(GStreamer) found
The main error is due to the lack of several packages, the specific package is as follows:
[Root@ftp demo]# rpm-qa |grep ^gstreamer* gstreamer-plugins-base-0.10.29-1.el6.x86_64
gstreamer-0.10.29-1.el6.x86_64
gstreamer-devel-0.10.29-1.el6.x86_64
gstreamer-plugins-base-devel-0.10.29-1.el6.x86_64
gstreamer-tools-0.10.29-1.el6.x86_64
See what packages are missing, and then install any dependent packages.
6, error OpenGL Library did not find
The specific error content is as follows:
Configure:error:OpenGL Libraries not available
The main missing dependency libraries are as follows:
[Root@ftp demo]# Rpm-qa|egrep "Mesa-libgl-devel|mesa-libglu-devel"
mesa-libgl-devel-7.11-3.el6.x86_64
Mesa-libglu-devel-7.11-3.el6.x86_64
Note that there are no bags with devel to be fitted accordingly. 7, in the installation of Wxpython when there are many errors
In the installation of Wxpython, if there are many compiler errors, the direct addition of parameter build_glcanvas=0, can also be directly ignored.
[root@ftp wxpython]# python setup.py build_ext--inplace--debug wx_config=/usr/local/pythonwxpython/bin/wx-config Build_glcanvas=0
8. Other problems
If there are other problems, the basic problem is to rely on the package, in turn, the installation of the above dependent package can be.