ubuntu安装wxpython库

概述

为了做一个小程序,要用到wxpython这个库,所以就需要安装下,因为我是使用pyenv去管理python的,所以安装这个库就使用pip安装了,系统是ubuntu16.04,python版本是2.7.14

操作

首先使用下面命令安装wxpython
pip install -U wxPython
报错

configure: error:
    The development files for GTK+ were not found. For GTK+ 2, please
    ensure that pkg-config is in the path and that gtk+-2.0.pc is
    installed. For GTK+ 1.2 please check that gtk-config is in the path,
    and that the version is 1.2.3 or above. Also check that the
    libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
    --libs' are in the LD_LIBRARY_PATH or equivalent.

安装下面这个库才可以解决
sudo apt-get install libgtk-3-dev
之后重新执行安装命令,又报错
configure: error: OpenGL libraries not available
安装下面这个包再重新执行安装命令
sudo apt install freeglut3-dev
接着又报错

checking for GST... configure: WARNING: GStreamer 1.0 not available, falling back to 0.10     
checking for GST... configure: WARNING: GStreamer 0.10 not available, falling back to 0.8     
configure: error: GStreamer not available     
Error running configure     
ERROR: failed building wxWidgets

安装下面这个包再重新执行安装命令
sudo apt install libgstreamer-plugins-base1.0-dev
接着安装的时候又报错,这个报错无解

    Checking for header Python.h                                                                                                        : :-(
    Asking python-config for pyembed --cflags flags                                                                                     : yes
    Asking python-config for pyembed --libs flags                                                                                       : yes
    Asking python-config for pyembed --ldflags flags                                                                                    : yes
    Getting pyembed flags from python-config                                                                                            : yes
    Asking python-config for pyext --cflags flags                                                                                       : yes
    Asking python-config for pyext --libs flags                                                                                         : yes
    Asking python-config for pyext --ldflags flags                                                                                      : yes
    Getting pyext flags from python-config                                                                                              : Could not build python extensions

如果有知道的告诉我下,其实上面的这些依赖关系官方都说明了

You will need the following packages (please consult your distributions package list for the appropriate names) and their dependencies:

python-dev (for your version of python)
gtk (preferably version 3, but depends on your needs)
gstreamer
glut
webkitgtk (matching your gtk version)

地址: https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html

而且在ubuntu安装wxpython的话有ubuntu的版本的,直接运行下面的命令安装就好了

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

欢迎关注Bboysoul的博客www.bboysoul.com
Have Fun

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值