Installed virtualenv and virtualenvwrapper: Python says no module named virtualenvwrapper

前端 未结 10 2212
挽巷
挽巷 2021-01-30 01:49

Lots of other threads about similar issues, but none that I could find where quite the same case as mine. So, here goes:

Things I did:

  • Ran
10条回答
  •  长发绾君心
    2021-01-30 02:07

    If you take a look at the virtualenvwrapper.sh script, you will find these lines:

    # Locate the global Python where virtualenvwrapper is installed.
    if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ] 
    then
        VIRTUALENVWRAPPER_PYTHON="$(command \which python)"
    fi
    

    If you don't manually export VIRTUALENVWRAPPER appropriately for your version of python, it will assume the system default where you don't have the virtualenvwrapper package installed.

    I fixed this like so:

    echo "export VIRTUALENVWRAPPER_PYTHON=$(which python3.6)" >> ~/.zshrc
    

    This is all documented on the official website here.

提交回复
热议问题