Search code examples
pythonsublimetext3anacondaconda

Sublime text : How to activate conda environment via build system


I would like to configure a second build system for Python on Sublime text 3. By default it use Python 2.7. for the time being, if I want to use Python 3.5, I execute activate py35 and it works like a charm.

Here is my original build system :

{
    "cmd": ["start", "cmd", "/k", "python", "-u", "-i", "$file"],
    "selector": "source.python",
    "shell": true,
    "working_dir": "$file_dir"
}

I added this line just before :

    "cmd": ["activate", "py35"],

I've found this question but it didn't help, which command isn't recognized, even if my env is activated :

enter image description here


Solution

  • You can't add another "cmd". JSON doesn't allow duplicate keys.

    You also don't need to activate anything. Give the full path to the Python executable

    For example

    "cmd": ["start", "cmd", "/k", "C:/Users/name/path/py35/Scripts/python",