ERROR: virtualenvwrapper could not find virtualenv in your path

后端 未结 12 1930
广开言路
广开言路 2021-02-01 01:06

I\'m trying to create a virtualenv with virtualenvwrapper, but when I use mkvirtualenv I get the following :

ERROR: virtualenvwrapper c         


        
相关标签:
12条回答
  • 2021-02-01 01:23

    Re-installling virtualenv fixed my problem.

    I had the same issue.

    $ mkvirtualenv mysite
    ERROR: virtualenvwrapper could not find virtualenv in your path
    

    After a lot of time consuming efforts, I decided to re-install virtualenv.

    sudo apt install virtualenv
    

    This fixed my issues. I already had virtualenv installed. But I think it got broken or met with some errors.

    0 讨论(0)
  • 2021-02-01 01:27

    I finally found out what the problem was :

    virtualenvwrapper.sh is written in BASH and not in Python. So virtualenv is called from a shell (zsh). I didn't have to bother about my PYTHONPATH, but about my PATH (I was already able to import virtualenv from my python shell anyway).

    I just added the correct directory to my PATH and everything worked fine.

    0 讨论(0)
  • 2021-02-01 01:29
    ERROR: virtualenvwrapper could not find virtualenv in your path
    

    This error means - program virtualenv is not in your system path. This mostly happens if you install virtualenv via pip without sudo. This kind of installation stores data in users local directory e.g ~/.local/bin. So first step is to find where this binary present. You can do that using locate program. First update its database using sudo updatedb. Then run locate *bin/virtualenv. Whatever path you get, append it in system path variable. This you can do by adding below line in your shell config file e.g. ~/.bashrc or ~/.zshenv.

    export PATH=$PATH:/your/path
    

    e.g.

    export PATH=$PATH:~/.local/bin
    

    Now open new shell and try again. Error should be gone.

    0 讨论(0)
  • 2021-02-01 01:29

    In my case, I tested use this command:

     sudo find / -name "virtualenv"
    

    and I have a list with all path to this file,

    I tested one to one and solved with path:

    export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
    

    My configurations to environment variables is :

    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    export WORKON_HOME=$HOME/.virtualenv
    export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
    source ~/.local/bin/virtualenvwrapper.sh
    

    in file .bashrc. Now all its works.

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

    Your PYTHONPATH makes me think you have Homebrew installed. It sounds like virtualenvwrapper was installed with either your system pip or your homebrew pip while it is being executed with the opposite python interpreter.

    0 讨论(0)
  • 2021-02-01 01:33

    I am using python3 with virtualenvwrapper installed on Ubuntu 18.04, using pip3 without sudo. If you are in this situation, you might find interesting my configuration.

    In the end of my .bashrc I added the following rows (remember to put your username in the YOUR_USERNAME field):

    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    export WORKON_HOME=$HOME/.virtualenvs
    export VIRTUALENVWRAPPER_VIRTUALENV=/home/YOUR_USERNAME/.local/bin/virtualenv
    source /usr/local/bin/virtualenvwrapper.sh
    

    Then restart the cli with ctrl-D ctrl-T or reload the config with source ~/.bashrc. Then you should be good to go! Try the installation with:

    lsvirtualenv
    mkvirtualenv test
    workon test
    deactivate
    rmvirtualenv test
    

    If you could create and delete a virtual environment, you are ready to go.

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