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

后端 未结 5 1212
我寻月下人不归
我寻月下人不归 2020-12-29 15:15

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

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 15:48

    On 10.10.3, using a virtualenv (via pyenv if it matters), I did a brew install wxmac.

    I have this atop of my application script

    import site
    site.addsitedir("/usr/local/lib/python2.7/site-packages")
    

    And I use this wrapper to run my script, called 'app.py'

    #!/bin/bash
    
    # what real Python executable to use
    PYVER=2.7
    PYTHON=/System/Library/Frameworks/Python.framework/Versions/$PYVER/bin/python$PYVER
    
    # pythonw is key here!
    PYTHON="pythonw"
    
    # now run Python with the virtualenv set as Python's HOME
    export PYTHONHOME=$VIRTUAL_ENV
    exec $PYTHON "$@"
    

    Run it with fwpy app.py

提交回复
热议问题