How to configure VS Code's Integrated Terminal to use the correct Python Interpreter

Viewed 1065

TL;DR

This question is NOT asking how to select a Python Interpreter to run, or debug, code with, furthermore; this question is NOT asking anything in regard to Virtual Environment, or how to activate a Virtual Environment, all of that is working. I feel it is important to note, that the question below has been asked previously, but failed to receive a satisfying answer due to confusion over what was being asked. Community Members often think one of the questions, that I mentioned at the beginning of this question, is being asked, here is a question that's a good example of what I just wrote here.



Here is My Question:

How can a user configure their Integrated Terminal to use an Interpreter that the user specifies?

I want to be able to configure my terminal to use the interpreter in my virtual environment — their is an example of my virtual environments interpreter in the Screenshot below.

  1. from the status bar that the VENV interpreter is active, and my code runs fine.

  2. from the Windows Terminal the system interpreter is being used.

VSCode using different interpreters

The problem that is caused by this, is that I can't run pip or other packages like PyInstaller from the Integrated Terminal because its not looking inside of my VENV, and furthermore; I don't want to globally install the packages.

Another problem that occurs is that, parts of my app include version sensitive packages, and I need to control the version of the python interpreter used by the Integrated Terminal.

1 Answers

I know this doesnt really answer the question but it may be of some help to some people, so here it is.

I have no idea what im doing but I finally fixed this issue... my issue was that I was trying to get the default interpreter to use python 3 instead of python 2.

I ended up deleting python 2 from my PATH...

in the end I realized that the path changed to this after I deleted Python 2, so maybe the solution can be found here.

maybe this? { "python.pythonPath": "C:\Users\T\AppData\Local\Programs\Python\Python310\python.exe", "window.zoomLevel": 0, "python.defaultInterpreterPath": "C:\Users\T\AppData\Local\Programs\Python\Python310\python.exe" }

Related