1

When launching Visual Studio Code from the Anaconda Navigator page, the python command works correctly in the integrated terminal (Powershell or Bash).

However, when Visual Studio Code is launched normally (from start menu), python.exe is not found in the terminal (not in path).

Is there a way to always apply Anaconda's config to VS Code, to avoid having to launch it from the Anaconda Navigator page?

thibautg
  • 2,004
  • 1
  • 14
  • 17

1 Answers1

2

When you installed Anaconda you probably had it leave the copy of Python in your base environment off of PATH. That means when you open your terminal it won't be found normally (this isn't specific to VS Code). One way to deal with this is to create conda environments for your project as those will get activated in the terminal when you use the Python: Create Terminal command. That will then make python available as a command from your terminal.

Brett Cannon
  • 14,438
  • 3
  • 45
  • 40
  • Yes it was recommended to leave Anaconda's `python.exe` off the `PATH`. I just would like to know what config is set by Anaconda when launching VS Code from Anaconda Navigator, and set it automatically when VS Code is launched from the start menu or command line. I don't want to set a specific env for each workspace. – thibautg Aug 14 '18 at 20:57
  • Seems to be similar to https://stackoverflow.com/questions/37199846/how-can-i-launch-an-exe-within-a-conda-env – thibautg Aug 14 '18 at 21:51
  • There is no config. The Anaconda Navigator is just manipulating `PATH` before launching VS Code. – Brett Cannon Aug 15 '18 at 16:43
  • And I would highly recommend creating an environment per workspace to keep your dependencies separate and independent per project. – Brett Cannon Aug 15 '18 at 16:44
  • You're right that it's better to create a separate env for projects/workspaces. But here I just would like to have access to `python`, `pip` etc. from code's integrated terminal, outside of a specific workspace and without setting it in Windows' global path. It works by launching code from Anaconda Navigator so i thought that it would be possible to set the correct path automatically while launching code. – thibautg Aug 15 '18 at 19:28
  • There might be a settings like `terminal.integrated.shellArgs` that you could play with to get what you're after. – Brett Cannon Aug 16 '18 at 23:22