Mac 上 wxPython 运行报错
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.
环境是
python 3.6.0
pyenv global 3.6.0
pip install wxpython
MacBook Pro:~ chenzhi$ python -c "import wx; print(wx.version())"
4.0.0b2 osx-cocoa (phoenix)
MacBook Pro:~ chenzhi$ which python
/usr/local/opt/pyenv/shims/python
MacBook Pro:MyGitlab chenzhi$ python -c "import site; print(site.getsitepackages())"
['/usr/local/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages']
MacBook Pro:MyGitlab chenzhi$ python -c "import sys,pprint; pprint.pprint(sys.path)"
['',
'/usr/local/opt/pyenv/versions/3.6.0/lib/python36.zip',
'/usr/local/opt/pyenv/versions/3.6.0/lib/python3.6',
'/usr/local/opt/pyenv/versions/3.6.0/lib/python3.6/lib-dynload',
'/usr/local/opt/pyenv/versions/3.6.0/lib/python3.6/site-packages']
import wx
app = wx.App()
window = wx.Frame(None,title="wxPython",size = (400,300))
panel = wx.Panel(window)
label = wx.StaticText(panel,label = "hello world",pos = (100,100))
window.show()
app.MainLoop()
MacBook Pro:~ chenzhi$ python hello.py
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如参考链接[1],你可能需要另外在你的执行环境下添加一个脚本来指定你的执行框架,详见链接。[1]https://github.com/conda/cond...