wxpython-phoenix 在 osx/ipython/pycharm 上需要 python 框架
wxpython-phoenix requires python framework on osx/ipython/pycharm
运行 wxpython-phoenix website throws a known error on osx. Hints at possible solutions can be found here, and here 上提供的示例 hello-world 代码,但 none 似乎适用于 ipython 和 pycharm。
问题:如何解决这个已知错误,使用 pycharm 中的 ipython?
设置:
OSX 10.12.5 塞拉
ipython conda venv 中的 3.7.1
pycharm CE 2018.3
(也从命令行和 jupyter notebook 失败)
代码运行:(来自wxpython入门页面)
import wx
app = wx.App()
frm = wx.Frame(None, title="Hello World")
frm.Show()
app.MainLoop()
错误信息
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.
完整追溯
---------------------------------------------------------------------------
SystemExit Traceback (most recent call last)
<ipython-input-1-5af94fb54276> in <module>
3
4 # Next, create an application object.
----> 5 app = wx.App()
6
7 # Then a frame.
~/anaconda3/envs/py37/lib/python3.7/site-packages/wx/core.py in __init__(self, redirect, filename, useBestVisual, clearSigInt)
2100 # TODO: more description is needed for wxMSW...
2101
-> 2102 raise SystemExit(msg)
2103
2104 # This has to be done before OnInit
SystemExit: 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.
注:本题类似于:
- that 一个用于 python2.7,但没有收到答复
- 为 python 之外的 pycharm
提供过时修复
其他问题,如 this one,在 wxpython 的新版本中已过时。
使用 conda 环境时,您需要安装 python.app
包,然后使用 pythonw
到 运行 使用 wxPython 的应用程序。
在osx上,命令行为:(如图here)
conda install -c anaconda python.app
您将看到以下消息;确认继续。
The following packages will be SUPERSEDED by a higher-priority channel:
python.app: 2-py37_9 --> 2-py37_9 anaconda
用pycharm,需要更改项目解释器:
--> 转到:
preferences
project interpreter
add interpreter
conda environment
anaconda (or anaconda3)
bin
pythonw
select pythonw
apply
ok
运行 wxpython-phoenix website throws a known error on osx. Hints at possible solutions can be found here, and here 上提供的示例 hello-world 代码,但 none 似乎适用于 ipython 和 pycharm。
问题:如何解决这个已知错误,使用 pycharm 中的 ipython?
设置:
OSX 10.12.5 塞拉
ipython conda venv 中的 3.7.1
pycharm CE 2018.3
(也从命令行和 jupyter notebook 失败)
代码运行:(来自wxpython入门页面)
import wx
app = wx.App()
frm = wx.Frame(None, title="Hello World")
frm.Show()
app.MainLoop()
错误信息
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.
完整追溯
---------------------------------------------------------------------------
SystemExit Traceback (most recent call last)
<ipython-input-1-5af94fb54276> in <module>
3
4 # Next, create an application object.
----> 5 app = wx.App()
6
7 # Then a frame.
~/anaconda3/envs/py37/lib/python3.7/site-packages/wx/core.py in __init__(self, redirect, filename, useBestVisual, clearSigInt)
2100 # TODO: more description is needed for wxMSW...
2101
-> 2102 raise SystemExit(msg)
2103
2104 # This has to be done before OnInit
SystemExit: 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.
注:本题类似于:
- that 一个用于 python2.7,但没有收到答复
-
提供过时修复
其他问题,如 this one,在 wxpython 的新版本中已过时。
使用 conda 环境时,您需要安装 python.app
包,然后使用 pythonw
到 运行 使用 wxPython 的应用程序。
在osx上,命令行为:(如图here)
conda install -c anaconda python.app
您将看到以下消息;确认继续。
The following packages will be SUPERSEDED by a higher-priority channel: python.app: 2-py37_9 --> 2-py37_9 anaconda
用pycharm,需要更改项目解释器:
--> 转到:
preferences
project interpreter
add interpreter
conda environment
anaconda (or anaconda3)
bin
pythonw
select pythonw
apply
ok