1

I've recently installed python3 via brew (also python2 via brew) and have untouched the system python (new laptop macOS).

I then installed virtualenvwrapper with pip3 install virtualenvwrapper

Then in my shell (zsh) I've added

    #set python3 as the default for new virtualenvs
    $ export VIRTUALENV_PYTHON=python3
    # set where virtual environments will live
    export WORKON_HOME=$HOME/.virtualenvs
        # set the folder for projects
        export PROJECT_HOME=$HOME/PycharmProjects
    # ensure all new environments are isolated from the site-packages          
    export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
    # use the same directory for virtualenvs as virtualenvwrapper
    export PIP_VIRTUALENV_BASE=$WORKON_HOME
    # makes pip detect an active virtualenv and install to it
    export PIP_RESPECT_VIRTUALENV=true
    if [[ -r /usr/local/bin/virtualenvwrapper.sh ]]; then
       source /usr/local/bin/virtualenvwrapper.sh
    else
       echo "WARNING: Can't find virtualenvwrapper.sh"
    fi

However whenever I run mkvirtualenv or I get an error:

 ...
 Installing setuptools, pip, wheel...done.
 /usr/bin/python: No module named virtualenvwrapper

Even though mkvirtualenv command seems to work as expected. However, mkproject does not neither does the workon command.

1 Answer 1

1

You installed virtualenvwrapper in python3 using pip3, but it accessed python2 while you ran mkvirtualenv

Set python3 as default using aliasing techniques. You can do it through https://stackoverflow.com/a/18425592/5334188

Also check virtualenvwrapper.sh path, by using which

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks in the end I unistalled it with pip3 install virtualenvwrapper then installed in with pip install --user virtualenvwrapper . This works perfectly and with $ export VIRTUALENV_PYTHON=python3 installs python3 virtualenvs by default

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.