Virtualenv: Workon Command Not Found

Virtualenv - workon command not found


So far it was working fine but I restarted the shell

The reason is because you restarted the shell.

If you want this to work with each shell, you'll need to add these to your ~/.bashrc file:

export WORKON_HOME=~/.virtualenvs
VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
source /usr/local/bin/virtualenvwrapper.sh

After adding this, you'll want to source ~/.bashrc so the changes take effect. You'll find that you have access to virtualenvwrapper facilities in each new shell.

virtualenvwrapper Command '' not found, but can be installed with

Add these two lines in your .bashrc file

export VIRTUALENVWRAPPER_PYTHON='/usr/bin/python3'
source /usr/local/bin/virtualenvwrapper.sh

Make sure to put them in this order exactly.

The first line means that virtualenvwrapper will use python 3.
You have to replace '/usr/bin/python3' with your python path. You can find it by typing which python

why virtualenv workon' not work but activate can

You are using it in powershell terminal in vscode try to create command prompt terminal in vscode and then you can able to use **workon newhouse** command.
Since workon is a batch script.
Try to run workon in cmd.
If you want to run it on powershell then i would recommend this stackoverflow question
[https://stackoverflow.com/a/38945456/14213012]

Virtual Environment Setup in Visual Studio Code -- Workon command

I use the following method to use the command "workon" in the terminal of VS Code, and you could refer to it:

  1. Install the module. (pip install virtualenvwrapper-win)

  2. Create a "virtualenv" environment. (mkvirtualenv name)

    Sample Image

    If you use the new environment created, please install "virtualenv" or "virtualenvwrapper-win" in it.

  3. Use the "workon" command. (workon name)

    Sample Image

Please use a terminal other than powershell in VS Code, because it does not activate the environment by default.

In addition, if you want to manage and use a virtual environment, it is very convenient to use python commands. (It is created without installing modules, and the created virtual environment exists in the project and displayed in the project structure.) You could refer to this docs: virtual environments in VS Code.



Related Topics



Leave a reply



Submit