admin管理员组

文章数量:1391981

So yesterday i noticed that the vscode terminal was using the global pip instead of the pip in my virtual environment when trying to use pip or package commands. Running the python file is no problem. I haven't been able to fix this since.

'pip list' command from vscode terminal

Here is the same command from cmd window:

'pip list' command from command prompt

So yesterday i noticed that the vscode terminal was using the global pip instead of the pip in my virtual environment when trying to use pip or package commands. Running the python file is no problem. I haven't been able to fix this since.

'pip list' command from vscode terminal

Here is the same command from cmd window:

'pip list' command from command prompt

Share Improve this question asked Mar 12 at 16:23 Mathis H.Mathis H. 33 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

This very likely means that your vscode terminal uses also the wrong Python environment and another Python executive than your project uses.

Set the Python Interpreter in VS Code
    1.  Open VS Code.
    2.  Open the Command Palette (Cmd + Shift + p) 
                                         (or: Ctrl + Shift + p)
    3.  Search for Python: Select Interpreter.
    4.  Select “Enter interpreter path” → “Find…”.
    5.  Navigate to the Python path of your project 
                (`which python` might help to clarify that from within 
                your project's python - if you are in windows, 
                install scoop and install linux tools using scoop install).
    6.  Confirm selection.

From your screenshots it appears that you do not have a virtual environment in your Windows DOS shell. Use a Linux command line emulator such as git bash or WSL. Setup `.bash_profile` with the following … source /.venv/bin/activate. To create a venv `python3 -m venv .venv `. In addition, you need to tell Code which interpreter to use. This is found here Selecting python interpreter in VSCode

本文标签: pythonVSCode terminal uses global pip instead of venv pipStack Overflow