如何在 Ubuntu 14.04 上安装 wxPython 3.0.2.0?

How to install wxPython 3.0.2.0 on Ubuntu 14.04?

我正在尝试从 src 安装 wxPython,因为我需要 Ubuntu 上的确切版本 3.0.2.0。 (因此,我无法遵循 related question 中的建议)我下载了源代码并执行了 ./configure、make 和 make install。它似乎已经结束,没有错误,出现以下消息。

The installation of wxWidgets is finished. On certain platforms (e.g. Linux) you'll now have to run ldconfig if you installed a shared library and also modify the LD_LIBRARY_PATH (or equivalent) environment variable. wxWidgets comes with no guarantees and doesn't claim to be suitable for any purpose.

我通过执行 import wx & wx.version() 确认我的安装没有工作。完成安装需要做什么?我应该在哪里设置 LD_LIBRARY_PATH 到?

尝试检查 wx 是否在 sys.pah。

你可以用这段代码来完成

import sys
print sys.path

输出必须是这样的/usr/lib/python2.7/dist-packages/wx

如果没有,将 wx 文件夹的路径添加到系统路径应该可以解决您的问题。

执行./configure、make 和make install 只会构建和安装wxWidgets。您还需要使用 build-wxpython.py 脚本构建 wxPython,默认情况下,该脚本还将使用已知的良好配置标志为您完成构建的 wxWidgets 部分。请参阅源压缩包中的 wxPython/docs/BUILD.txt。

gtk3 应该先安装

$sudo apt-get libgtk-3-dev

如果您在 Python3 上安装 wxpython 时遇到问题,请使用此命令安装 wxpython

$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython

通过这个命令你可以安装最新的wxPython4版本。 如果您使用 Windows 或 macOS

$ pip install -U wxpython

您可以从这里获得旧版本 link https://sourceforge.net/projects/wxpython/files/wxPython/