2

I cannot seem to get Python3 interpreter to build inside sublime text using Anaconda. I have tried all possible configurations but to no avail, the system does not seem recognize installed libraries and throws an importError back at me.

this is my python project's settings for anaconda:

{
    "build_systems":
    [
        {
            "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
            "name": "Anaconda Python Builder",
            "selector": "source.python",
            "shell_cmd": "\"/usr/local/bin/python3\" -u \"$file\""
        }
    ],
    "folders":
    [
        {
            "path": "Practice"
        }
    ],
    "settings":
    {
        "python_interpreter": "python3"
    }
}

edit: python3 installed with homebrew

Suraj Sharma
  • 153
  • 1
  • 3
  • 9

3 Answers3

4

Tools -> Command Palette -> Anaconda: Set Python interpreter

Dmitry
  • 73
  • 6
  • How can this be added to the Anaconda user settings file? – Tudor Nov 16 '18 at 12:31
  • You need to install `Anaconda` package first, then you can find `Anaconda: Set Python interpreter` in `Tools -> Command Palette` – shihs Oct 17 '21 at 08:01
3

Try this:

{
    "python_interpreter": "/usr/local/bin/python3",

}

This only works if you installed it to that actual path, which should be the case if you used homebrew.

To confirm try in your shell:

which python3
BluePython
  • 1,635
  • 3
  • 24
  • 35
2

solved this by creating a new build system in ST3 (Tools> Build System> New Build System...)

{
    "cmd": ["/usr/local/bin/python3.6", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)"
}

saved as Python3

Suraj Sharma
  • 153
  • 1
  • 3
  • 9