V
V
Vadim2021-06-29 20:24:51
Visual Studio Code
Vadim, 2021-06-29 20:24:51

Can VsCode be configured to pick up the correct python interpreter and virtual environment?

Hello everyone,

in linux command line I create a new project in e.g.

mkdir newproject && cd newproject
pipenve install --python 3.8
pipenv shell

then code .

and vscode is launched, the cat uses the old path to the python interpreter, the cat has to be updated every time!

Is it possible to make vscode automatically pull up the correct interpreter and, accordingly, the virtual environment?

all the best,
Vadim

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim, 2021-06-30
@Viji

Yes, you need to create a .vscode subfolder and write the path to the interpreter there ... in the settings.json file,
this can be automated using a bash script
$ cat settings.json
{
"python.pythonPath": "/home/vadim/.local/share /virtualenvs/lambda-cleanup-YdfgdfyT/bin/python"
}
see below...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question