【问题标题】:How can I install wxPython 3.0.1.1 in Python 2.7 virtualenv on Ubuntu 14.10?如何在 Ubuntu 14.10 上的 Python 2.7 virtualenv 中安装 wxPython 3.0.1.1?
【发布时间】:2014-12-10 13:12:53
【问题描述】:

以下过程失败。我错过了什么吗?

  • 安装各种 Ubuntu 软件包(编译的先决条件)
  • 获取http://downloads.sourceforge.net/wxpython/wxPython-src-3.0.1.1.tar.bz2
  • 解压到wxPython-src-3.0.1.1/
  • 创建名为test 的新虚拟环境
  • 激活test virtualenv
  • 在终端,来自wxPython-src-3.0.1.1/:

    ./configure --prefix=/home/username/.virtualenvs/test --with-gtk2 --enable-unicode --with-opengl
    #lots of output, confirms "Configured wxWidgets 3.0.1 for `x86_64-unknown-linux-gnu'"
    
    make install
    #lots of output, confirms:
    # 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.
    
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.virtualenvs/test/lib
    # don't run ldconfig since that is a system tool, not appropriate for virtualenv?
    
    cd wxPython
    python setup.py install
    # lots of output, starting:
    # WARNING: WXWIN not set in environment. Assuming '..'
    # Found wx-config: /home/username/.virtualenvs/test/bin/wx-config
    #     Using flags:  --toolkit=gtk2 --unicode=yes --version=3.0
    # Preparing CORE...
    # Preparing STC...
    # Preparing GLCANVAS...
    # Preparing GIZMOS...
    # running install
    # etc
    

最终命令失败:

src/gtk/_core_wrap.cpp:20407:7: note: ‘arg3’ was declared here
   int arg3 ;
       ^
src/gtk/_core_wrap.cpp: In function ‘PyObject* _wrap_Image_SetAlphaBuffer(PyObject*, PyObject*, PyObject*)’:
src/gtk/_core_wrap.cpp:3747:13: warning: ‘arg3’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if (ALPHASIZE != self->GetWidth() * self->GetHeight()) {
             ^
src/gtk/_core_wrap.cpp:20474:7: note: ‘arg3’ was declared here
   int arg3 ;
       ^
cc1plus: some warnings being treated as errors
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

【问题讨论】:

标签: python python-2.7 wxpython virtualenv ubuntu-14.10


【解决方案1】:

我使用python setup.py install &> ~/error.txt 将错误消息传递给知识渊博的同事,他们发现C 编译正在使用-Werror=format-security 标志。此版本的 wxPython(可能还有其他版本)无法使用该标志进行编译。

我的 $CPPFLAGS 和 $CFLAGS 环境变量为空。原来这个flag是hardening-wrapper触发的。

所以,我通过调用最后一步来覆盖标志,如下所示,wxPython 安装成功:

CFLAGS=-Wno-error=format-security CPPFLAGS=-Wno-error=format-security python setup.py install

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-10
    • 2016-05-22
    • 1970-01-01
    • 1970-01-01
    • 2014-12-22
    • 1970-01-01
    • 2011-05-02
    • 1970-01-01
    相关资源
    最近更新 更多