Search code examples
pythonpython-3.xwxpythonanacondaminiconda

wxPython on Python 3 Miniconda environment


Trying out wxPython Phoenix for Python 3.3 on OS X. (I'm not sure which version of Python 3 Phoenix supports, I force-install it.

>>> import wx
>>> 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.

Now I read this which says there is a problem wxPython has with virtualenv and provided a fix via this script:

#!/bin/bash

# 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 "$@"

I can't read BASH (what's $@?) but it looks like it's just a matter of setting PYTHONHOME. I am running wxPython Phoenix on Python 3, not Python 2. And I'm not using virtualenv. I'm Miniconda. I don't know where to set PYTHONHOME to. I set it in PYTHONHOME="/Users/username/miniconda3/" but it doesn't work.


Solution

  • A better fix is to use pythonw (install the python.app conda package) instead of python.