Issues

Issue #178 resolved

--python option is sticky (unlike how virtualenv works)

Phillip Marshall
created an issue

On virtualenvwrapper 3.7, virtualenv 1.8.4, python 2.7.x, and os x 10.8.2.

OS X comes with Python 2.7.2, but I need 2.7.3 for my projects. I was looking for away to make virtualenvwrapper set up environments using my preferred python installation rather than the built-in one (it and virtualenv are preferring the built-in one even though my 2.7.3 one is the first in my $PATH.) I still haven't figured out how to set the default one for virtualenvwrapper, but it's no big deal really and that's not what this ticket is for.

This bug is that virtualenvwrapper keeps the --python option throughout the shell session, rather than only using it when specified.

To demonstrate, here's how it works with virtualenv (how it should work), and how it works in virtualenvwrapper:

$ virtualenv xxx
New python executable in xxx/bin/python
Installing setuptools............done.
Installing pip...............done.
$ source xxx/bin/activate
(xxx)$ python --version
Python 2.7.2
(xxx)$ deactivate
$
$ virtualenv -p `type -p python` yyy
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/2.7/bin/python
New python executable in yyy/bin/python
Installing setuptools............done.
Installing pip...............done.
$ source yyy/bin/activate
(yyy)$ python --version
Python 2.7.3
(yyy)$ deactivate
$
$ virtualenv zzz
New python executable in zzz/bin/python
Installing setuptools............done.
Installing pip...............done.
$ source zzz/bin/activate
(zzz)$ python --version
Python 2.7.2
(zzz)$ deactivate
$ #the zzz environment uses python 2.7.2, as is the default.
$ mkvirtualenv aaa
New python executable in aaa/bin/python
Installing setuptools............done.
Installing pip...............done.
(aaa)$ python --version
Python 2.7.2
(aaa)$ deactivate
$
$ mkvirtualenv -p `type -p python` bbb
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/2.7/bin/python
New python executable in bbb/bin/python
Installing setuptools............done.
Installing pip...............done.
(bbb)$ python --version
Python 2.7.3
(bbb)$ deactivate
$
$ mkvirtualenv ccc
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/2.7/bin/python
New python executable in ccc/bin/python
Installing setuptools............done.
Installing pip...............done.
(ccc)$ python --version
Python 2.7.3
(ccc)$ deactivate
$ #notice how the ccc environment has python 2.7.3 installed, even though it should be 2.7.2.

Fair warning: I am running this on hackintosh, which has been causing some compiling issues with homebrew, and has made me end up with multiple python binaries that probably aren't organized quite right. I don't think this is really related, but it should be pretty easy to test on another machine if need be.

Comments (3)

  1. Log in to comment