I have Anaconda working on my system and VsCode working, but how do I get VsCode to activate a specific environment when running my python script?
Select and activate an environment# To select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).
To activate your Conda environment, type source activate <yourenvironmentname> . Note that conda activate will not work on Discovery with this version. To install a specific package, type conda install -n <yourenvironmentname> [package] . To deactivate the current, active Conda environment, type conda deactivate .
Simply use
Quoting the 'Select and activate an environment' docs
Selecting an interpreter from the list adds an entry for
python.pythonPath
with
the path to the interpreter inside your Workspace Settings.
If Anaconda is your default Python install then it just works if you install the Microsoft Python extension.
The following should work regardless of Python editor or if you need to point to a specific install:
In settings.json edit python.path with something like
"python.pythonPath": "C:\\Anaconda3\\envs\\py34\\python.exe"
Instructions to edit settings.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With