Issue
I am trying to activate the Python virtual environment using workon
command in Visual Studio Code. Typing command workon
is listing all the virtual environments already available, but when I am typing the command workon env-name
to activate the environment, nothing is happing and I am also not getting any errors. Can someone help me with this problem?
Solution
I use the following method to use the command "workon" in the terminal of VS Code, and you could refer to it:
Install the module. (
pip install virtualenvwrapper-win
)Create a "virtualenv" environment. (
mkvirtualenv name
)If you use the new environment created, please install "virtualenv" or "virtualenvwrapper-win" in it.
Use the "workon" command. (
workon name
)
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.
Answered By - Jill Cheng Answer Checked By - Marie Seifert (WPSolving Admin)