0

I tried but completely failed to find any useful info on this particular subject on the internet.

I am a beginner in Django. I installed "virtualenv" with pip, and created an environment under "D:\Dropbox\Git\Python\Django_projects" called "env_mysite."

In the Command Prompt, everything works as expected. But now, since I tried to code with Visual Studio Code, I would like to use "Ctrl+Shift+P" to quickly select python interpreter, which in my case would be either the "normal python" or the one in the virtual environment in the D: path aforementioned... it depends on the project.

After googling, I understand it seems that this may be because of the wrong path settings in the User Settings in VS Code.

My current path settings are as below:

python.venvPath and python.pythonPath.

I hope some of you guys can help me with how to set the correct path under Windows.

Appreciated.

1 Answer 1

1

If your project is under D:\Dropbox\Git\Python\Django_projects and env_mysite is the only virtual environment, then open the Django_projects folder in VS Code and the Python extension will simply discover your virtual environment.

If your code lives elsewhere then you will want to set "python.pythonPath": "D:\\Dropbox\\Git\\Python\\Django_projects\\Scripts\\python.exe".

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot Brett! Took me days to understand how this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.