Sunday, September 4, 2022

[SOLVED] VS Code cannot activate virtual environment with env\Scripts\activate.bat

Issue

I've been looking at all sorts of sources and I cannot make it happen that a virtual environment is created. I have serious problems with the Terminal. Whereas in the other sources by just typing the commands as instructed like \env\Scripts\activate.bat works perfectly, for me I just get an error saying it is not recognized as a name of a cmdlet nor a function nor a script file nor an executable program, see screenshot. It's a nightmare. I also e.g. changed the settings.json as in some suggested methods, but no luck.

enter image description here


Solution

In the virtual environment Scripts folder there are 2 activate scripts: activate.bat and activate.ps1. .bat files aren't recognized in the terminal. Try running just env\Scripts\activate.



Answered By - RustyPython
Answer Checked By - Mary Flores (WPSolving Volunteer)