How to install wxPython
Bored of using Java for making GUI App, I want to switch to another language that can handle the cross-platform problem with GUI, wxPython comes into my cup of tea.
Unfortunately, since i'm using Ubuntu 12.04 to dev and all of the packages are pretty much outdated, plus the instruction is not clear enough on how to install wxPython 3.0.0 on Ubuntu 12.04. At first it created a lot of conflicts between packages but I managed to come up with good way to install wxPython 3.0.0 on Ubuntu 12.04:
1. Get all the dependencies needed: (it takes couple minutes)
2. Download and create build directory: (Check for the lastest package at: http://sourceforge.net/projects/wxpython/ )sudo apt-get install dpkg-dev build-essential swig python2.7-dev libwebkitgtk-dev libjpeg-dev libtiff-dev checkinstall ubuntu-restricted-extras freeglut3 freeglut3-dev libgtk2.0-dev libsdl1.2-dev libgstreamer-plugins-base0.10-dev
3. Build and Install:wget http://downloads.sourceforge.net/wxpython/wxPython-src-3.0.0.0.tar.bz2 tar xvjf wxPython-src-3.0.0.0.tar.bz2 cd wxPython-src-3.0.0.0/ mkdir bld cd wxPython/
4. To remove, just simply do:sudo checkinstall -y --pkgname=wxpython --pkgversion=3.0.0 --pkgrelease=1 --pkglicense=wxWidgets --pkgsource=http://www.wxpython.org/ --maintainer=reingart@gmail.com --requires=python-wxversion,python2.7,python -D python build-wxpython.py --build_dir=../bld --install
dpkg -r wxpython
And that's it, we pretty much install it on our Ubuntu 12.04. You can check it by 'import wx' in python command line.
Note that when you first run you will run into some errors like:
It is time to run this command in terminal 'sudo ldconfig' in order to get everything works.Type "help", "copyright", "credits" or "license" for more information. >>> import wx Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/wx-2.9.4-gtk2/wx/__init__.py", line 45, in <module> from wx._core import * File "/usr/local/lib/python2.6/dist-packages/wx-2.9.4-gtk2/wx/_core.py", line 4, in <module> import _core_ ImportError: libwx_gtk2u_xrc-2.9.so.4: cannot open shared object file: No such file or directory
Good luck :) !
I just tried this on Linux Mint and it worked a charm first time! (well, once I'd done the 'sudo ldconfig'). Thanks so much for these instructions.
ReplyDeleteconfigure: error: C compiler cannot create executables
ReplyDeleteThis doesn't work on Linux Mint 17. In a Python2 command line session here is the output after typing "import wx" :
ReplyDelete>>> import wx
Traceback (most recent call last):
File "", line 1, in
File "wx/__init__.py", line 45, in
from wx._core import *
File "wx/_core.py", line 4, in
import _core_
ImportError: No module named _core_
After typing in and running "sudo ldconfig", the problem as I outlined above remains.
DeleteThis comment has been removed by a blog administrator.
ReplyDelete