weixin_30872487 2015-09-28 01:58 采纳率: 0%
浏览 5794

wxpython 在mac下 无法调用?

本人系统如下:
mac os x 系统 10.10.5
wxpython wxPython3.0-osx-3.0.2.0-carbon-py2.7
anaconda 3.17.0
无论是在qtconsole还是终端下都无法调用wxpython,表现如下:

Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, Sep 15 2015, 14:29:08)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

import wx
app=wx.App()
This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.

上google查到以下网址:

wxPythonVirtualenvOnMac

RunSnakeRun (wxPython) apps in a Brew Virtualenv

本人不是软件开发相关专业,python初学,英语一般般,实在看不懂网页内容。。。

请问怎样才能正确调用wxpython?

  • 写回答

1条回答 默认 最新

  • 勇往直前的胖子 2015-10-10 16:28
    关注

    你的wxpython是不是安装在了virtualenv中?如果是的,尝试执行以下命令试试:

     # what real Python executable to use
    PYVER=2.7
    PYTHON=/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python$PYVER
    
    # find the root of the virtualenv, it should be the parent of the dir this script is in
    ENV=`$PYTHON -c "import os; print os.path.abspath(os.path.join(os.path.dirname(\"$0\"), '..'))"`
    
    # now run Python with the virtualenv set as Python's HOME
    export PYTHONHOME=$ENV 
    exec $PYTHON "$@"
    
    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题