在Linux下从源代码安装wxPython
我正在尝试在Linux上从源代码安装wxPython。我按照以下步骤操作:
- 从这个链接下载wxPython:http://downloads.sourceforge.net/wxpython/wxPython-src-2.8.12.1.tar.bz2
运行命令
./configure --prefix=$HOME/Local
在配置过程结束时,输出结果是:Configured wxWidgets 2.8.12 for `x86_64-unknown-linux-gnu' Which GUI toolkit should wxWidgets use? GTK+ 2 Should wxWidgets be compiled into single library? no Should wxWidgets be compiled in debug mode? no Should wxWidgets be linked as a shared library? yes Should wxWidgets be compiled in Unicode mode? no What level of wxWidgets compatibility should be enabled? wxWidgets 2.4 no wxWidgets 2.6 yes Which libraries should wxWidgets use? jpeg sys png sys regex sys tiff builtin zlib sys odbc no expat builtin libmspack no sdl no
接着运行
make
wxPython,看起来没有错误。- 然后运行
make install
但是当我在Python控制台(版本2.7)中尝试 import wx
时,Python找不到这个模块。
所以我有几个问题:
- 虽然wxPython似乎没有错误地构建和安装,但我是不是漏掉了什么依赖项?
- 在安装过程中我是不是遗漏了什么步骤?
- 我该如何让Python知道这个新安装的包?
任何提示、链接或文章都非常感谢。
2 个回答
我正在一台运行Python 2.7的CentOS机器上安装WxPython 3.0。
即使我关闭了mediactrl,安装程序还是会搜索GStreamer,并且出现错误提示
"configure: error: GStreamer not available"
,尽管GStreamer在我的机器上是可用的。
以下是两个这样的构建的详细信息:
我的想法是关闭mediactrl,所以我使用了以下选项:
python build-wxpython.py --extra_setup=disable-mediactrl --build_dir=../bld
或者
python build-wxpython.py --extra_setup="--disable-mediactrl --build_dir=../bld
然而,它仍然在搜索GStreamer,并输出下面的错误信息。我重新安装了GStreamer 0.10,并放到了\usr\lib\GStreamer 0.10,但我仍然收到相同的错误信息。
错误信息:
checking what is the type of the third argument of getsockname... socklen_t
checking what is the type of the fifth argument of getsockopt... socklen_t
checking for linux/joystick.h... yes
checking for python... /home/aptRoot/tools/python/64/Python-2.7/bin/python
checking for WEBKIT... configure: WARNING: webkitgtk not found.
configure: WARNING: WebKit not available, disabling wxWebView
checking for CAIRO... yes
checking for cairo_push_group... yes
checking for GST... configure: WARNING: GStreamer 0.10 not available, falling back to 0.8
checking for GST... configure: WARNING: GStreamer 0.8/0.10 not available.
configure: error: GStreamer not available
Error running configure
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "build-wxpython.py", line 378, in <module>
wxbuild.main(wxscript, build_options)
File "/home/hemadris/iAPT/install/wxPython-src-3.0.0.0/build/tools/build-wxwidgets.py", line 364, in main
"Error running configure")
File "/home/hemadris/iAPT/install/wxPython-src-3.0.0.0/build/tools/build-wxwidgets.py", line 80, in exitIfError
raise builder.BuildError(msg)
BuildError
对于 wxPython 2.8.x 版本,这里有完整的从源代码构建的说明:
http://wxpython.org/BUILD-2.8.html
如果你想使用 2.9 版本,可以参考以下说明: http://wxpython.org/builddoc.php
如果你遇到问题,可以加入 wxPython 用户的邮件列表或 Google 组,链接在这里: http://wxpython.org/maillist.php
告诉他们你使用的 wxPython 和 Python 版本,以及你用的 Linux 系统,几乎肯定会有人帮你。那里有很多 Linux 的高手。