VS Code debugger not using virtual environment in WSL?

Viewed 251

I'm currently learning how to make Django projects but the material uses the Linux command shell and the instructors use Macs. I run a Windows machine, so I have to use WSL and Bash.

I'm trying to use the VS Code debugger with a Python virtual environment created in a Bash terminal with WSL. I create my virtual environments by opening up a terminal in VS Code, entering the Bash terminal, then typing python -m venv venvname.

On the bottom right of VS Code there's something like this where I can click on the Python version number to change the interpreter.enter image description here If I then click "Enter interpreter path" then "Find" it brings up a Windows Explorer menu where I can direct it to a python executable, but it seems that virtual environments for Linux (created through a Bash terminal) don't have a python.exe. I have a python file with seemingly no extension that I am also unable to open.

I've tried using a venv created with Windows powershell in VSC just for testing purposes. After creating the venv, VSC gives me a notification ask if I want to use the newly created venv (I get no such prompt when creating venvs with bash) and confirming makes the Python version number also indicate that it's using a venv. The files also has an actual python.exe file but it comes with other problems. I can't run the Activate.ps1 script to enter the venv in VSC. I can activate the venv by running command prompt/powershell outside of VSC as administrator, but it seems to have issues installing older versions of packages when I try to install from file with pip install -r requirements.txt.

0 Answers
Related