Skip to content

Commit

Permalink
Merge pull request #5516 from nils-werner/osx-venv-alias
Browse files Browse the repository at this point in the history
OSX virtualenv fixing by creating a simple alias
  • Loading branch information
jenshnielsen committed Dec 7, 2015
2 parents ca892ea + 22849c3 commit 42ea00f
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion doc/faq/virtualenv_faq.rst
Expand Up @@ -77,7 +77,12 @@ The issue has been reported on the virtualenv bug tracker `here
<https://github.com/pypa/virtualenv/issues/54>`__ and `here
<https://github.com/pypa/virtualenv/issues/609>`__

Until this is fixed, a workaround is needed. The best known workaround,
Until this is fixed, one of the following workarounds must be used:

``PYTHONHOME`` Script
---------------------

The best known workaround,
borrowed from the `WX wiki
<http://wiki.wxpython.org/wxPythonVirtualenvOnMac>`_, is to use the non
virtualenv python along with the PYTHONHOME environment variable. This can be
Expand Down Expand Up @@ -108,6 +113,27 @@ framework build within the virtualenv. To run a script you can do
framework build. To run an interactive ``IPython`` session with the framework
build within the virtual environment you can do ``frameworkpython -m IPython``

``PYTHONHOME`` Function
-----------------------

Alternatively you can define a function in your ``.bashrc`` using

.. code:: bash
function frameworkpython {
if [[ ! -z "$VIRTUAL_ENV" ]]; then
PYTHONHOME=$VIRTUAL_ENV /usr/local/bin/python "$@"
else
/usr/local/bin/python "$@"
fi
}
This function can then be used in all of your virtualenvs without having to
fix every single one of them.

PythonW Compiler
----------------

In addition
`virtualenv-pythonw-osx <https://github.com/gldnspud/virtualenv-pythonw-osx>`_
provides an alternative workaround which may be used to solve the issue.

0 comments on commit 42ea00f

Please sign in to comment.