ARTICLE AD BOX
I am using a venv for my current Python project in VS Code 2022 on Windows 11. I started having issues when I tried installing nodeenv into my venv, and it kept installing globally despite me running
py -m pip install nodeenvwhich is supposed to install it within the venv. I then did further digging and discovered issues with VS Code recognizing the venv python executable itself. The terminal prompt correctly displays "(.venv)" at the start of every prompt, and I selected the python.exe in the venv from the command palette, and you can see it properly displayed at the bottom right corner of my screen in the following screenshot. However when I run
Get-Command pyit returns to me the global path, not the executable within the venv folder:
Google AI told me this Python script can check if the venv is active, if the prefixes are different and it returns False, it's active, if it returns True the venv isn't active
py -c "import sys; print(sys.prefix == sys.base_prefix)"When I run this it returns "True" indicating my venv is not active.
So why is my venv not properly active despite the terminal saying "(.venv)" and VS Code even showing that I have the python executable within my venv selected on the bottom of the screen? If it means anything this is an Azure function, so maybe that is messing with some of the venv connectivity?


