How can I use the same virtual environment in PowerShell outside of Visual Studio Code?

43 Views Asked by At

Initially, I used to activate the virtual environment (VE) in PowerShell by simply using 'pipenv shell'. However, I wanted to utilize the same VE in Visual Studio Code (VS Code), so I followed this article. Now, I can access the same VE, and it is working perfectly fine in VS Code. However, I am unable to create the VE in PowerShell. I have tried multiple solutions, including changing the environment variables, but nothing works for me. I just want to use the same VE that is currently being used in VS Code so that I can run my script in PowerShell outside VS Code.

1

There are 1 best solutions below

0
JialeDu On

First of all the vscode terminal uses the computer terminal as an integrated terminal, no different than if you were using the Power shell externally.

If you want to activate the environment in an external terminal, this is the same as in vscode, except that you have to type the commands yourself.

  • First navigate to the terminal directory in your workspace directory

  • Then activate the environment using the script in the virtual environment

enter image description here