use conda environment in sublime text 3

后端 未结 3 1515
小蘑菇
小蘑菇 2020-12-12 18:05

Using Sublime Text 3, how can I build a python file using a conda environment that I\'ve created as in http://conda.pydata.org/docs/using/envs.html

3条回答
  •  悲哀的现实
    2020-12-12 19:00

    A standard Python .sublime-build file looks like this:

    {
        "cmd": ["/path/to/python", "-u", "$file"],
        "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
        "selector": "source.python"
    }
    

    All you need to do to use a particular conda environment is modify the path to the python or python3 executable within the environment. To find it, activate your environment and type (depending on the version you're using)

    which python
    

    or

    which python3
    

    on Linux/macOS, or

    where python
    

    on Windows, then copy the path into your custom .sublime-build file. Save the file in your Packages/User directory, then make sure you pick the right one via Tools -> Build System before building.

提交回复
热议问题