I've got various versions of python installed on my Mac using Macports. When I've selected python 2.7 via $ port select python python27
, virtualenvwrapper works perfectly.
But if I select another version of python, i.e. 2.6, virtualenvwrapper generates an error message: ImportError: No module named virtualenvwrapper.hook_loader
I checked my .profile and it's setting VIRTUALENVWRAPPER_PYTHON
to /opt/local/bin/python
, so it seems to me virtualenvwrapper should work regardless of which python I've selected.
Any idea what would cause virtualenvwrapper to generate a .hook_loader error when I switch python versions?
Installing Virtualenv using pip3You must first install a custom version of Python 3. This custom installation of Python 3 will also contain pip3. After it's installed and activated, run the which python3 command as shown in the article. This should return the location of your custom version of Python 3.
By default, that will be the version of python that is used for any new environment you create. However, you can specify any version of python installed on your computer to use inside a new environment with the -p flag : $ virtualenv -p python3. 2 my_env Running virtualenv with interpreter /usr/local/bin/python3.
You can select the python version explicitly
mkvirtualenv -p python3 venvname
or
mkvirtualenv -p python2.7 venvname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With