Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How execute python command within virtualenv with Visual Studio Code

I have created virtual environment named virualenv. I have scrapy project and I am using there some programs installed in my virtualenv. When I run it from terminal in VSC I can see errors even when I set up my virtual environment via Ctrl+Shift+P -> Python: Select Interpreter -> Python 3.5.2(virtualenv). Interpreter works in some way, I can import libs without errors etc, but I am not possible to start my scrapy project from terminal. I have to activate my virtual environment first via /{path_to_virtualenv}/bin/activate. Is there a way, how to automatically activate it? Now I am using PyCharm and it is possible there, but VSC looks much better according to me.

like image 287
dorinand Avatar asked Feb 04 '26 06:02

dorinand


1 Answers

One way I know how,

Start cmd Start you virtual env (helloworld) \path\etc> code .

It will start studio code in this environment. Hope it helps

like image 126
Rein Fowler Avatar answered Feb 06 '26 11:02

Rein Fowler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!