0

First of all, i'm using bash in windows. I'm trying to write the correct paths to my virtualenv in VSCode but I must be doing something wrong Any help will be really appreciated! thank you guys!

"python.pythonPath": "C\\Users\\Angel\\AppData\\Local\\Packages\\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\\LocalState\\rootfs\\home\\aquesada\\.local\\share\\virtualenvs\\videoclub_django_new-coDPKRdg\\bin\\python",
"python.linting.pylintPath": "C\\Users\\Angel\\AppData\\Local\\Packages\\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\\LocalState\\rootfs\\home\\aquesada\\.local\\share\\virtualenvs\\videoclub_django_new-coDPKRdg\\bin\\pylint",
"python.venvPath": "C:\\Users\\Angel\\AppData\\Local\\Packages\\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\\LocalState\\rootfs\\home\\aquesada\\.local\\share\\virtualenvs"
Gama11
  • 31,714
  • 9
  • 78
  • 100
AngelQuesada
  • 387
  • 4
  • 19

1 Answers1

0

virtual env as environmental variable

A virtual environment will set an environmental variable.

In Windows, you should be able to view that variable via echo %VIRTUAL_ENV%

In your Python code, you can grab that env var via os.environ['VIRTUAL_ENV']

VS Code config

python.venvPath should work. A few more things for you to try:

  • adjust path formatting: a single backslash as delimiter should work; AFAIK Windows only requires two consecutive backslashes at the start of the path
  • restart VS Code after updating configuration
  • use the Command Palette to select the Python interpreter from your virtual environment
Zach Valenta
  • 1,783
  • 1
  • 20
  • 35