Installed virtualenv and virtualenvwrapper: Python says no module named virtualenvwrapper

前端 未结 10 2093
挽巷
挽巷 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:10

    I've managed to get this working after having the same problem you've described here by editing my ~/.bash_profile and adding this:

    export WORKON_HOME=$HOME/code/.virtualenvs
    export PROJECT_HOME=$HOME/code
    export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
    export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
    export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
    
    source /usr/local/bin/virtualenvwrapper.sh
    

    Save, close.

    then:

    $ source ~/.bash_profile
    

    and:

    $ mkvirtualenv test
    
    0 讨论(0)
  • 2021-01-30 02:11

    I don't know if it's relevant to anyone but I got this error while editing ~/.zshrc while virtualenv being active. So I had to deactivate and then rmvirtualenv env_name to remove the errors. And then I recreated the env: mkvirtaulenv env_name and workon env_name and this time I got no errors.

    Hope it helps someone.

    0 讨论(0)
  • 2021-01-30 02:20

    In Ubuntu 20.xx, virtual env can be created only by specifying python executable path.

    $ which python3
    /usr/bin/python3
    $ mkvirtualenv --python=/usr/bin/python <name_of_your_virtual_env>
    
    0 讨论(0)
  • 2021-01-30 02:24

    Try to uninstall your virtualenv and virtualenvwrapper and install it again using pip (check if you symlink your pip or assigned an alias on it for other version) in version 2.7 (I think).

    I encountered the same error and I just did this and solved my problem.

    I using Ubuntu machine.

    I hope this help.

    0 讨论(0)
提交回复
热议问题