Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are Python builds suddenly not Framework builds when using virtualenv?

I've installed Python 2.7 as a Framework build on my Mac. I've installed and confirmed that wxPython works with this Python build. But when I create a virtual environment with virtualenv, the resulting Python executable isn't a Framework build, or at least not according to 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.

Any ideas?

like image 331
Hubro Avatar asked Nov 06 '12 11:11

Hubro


1 Answers

Another solution is to add the following script to /Path/To/VirtualEnv/bin:

ENV=`python -c "import sys; print sys.prefix"`
PYTHON=`python -c "import sys; print sys.real_prefix"`/bin/python
export PYTHONHOME=$ENV
exec $PYTHON "$@"

Then, whenever you want to run GUI (ex wxPython) use my_script main.py (make sure that virtualenv is active)

like image 76
Kentzo Avatar answered Oct 07 '22 00:10

Kentzo