下载conda插件
Preference-->Package Control-->install package--> Conda(单击)
更改build system
Tools-->build system-->Conda
配置环境
把默认的Python环境改成已创建的虚拟环境的python
Preferences-->Package Settings-->Conda-->Settings
会出现两个窗口,在右侧的窗口写下下面的代码:
/Default settings for sublime-text-conda:{// executable is the path to anaconda's python// this python executable is used in order to find conda//"executable": "~/anaconda3/bin/python3","executable":"/home/**/anaconda3/envs/***/bin/python",// conda虚拟环境中的python路径 //自行更新一下 **: username, ***: conda environment name // Directory in which the conda envs are stored// Default location is the user's home directory//"environment_directory": "~/anaconda3/envs/","environment_directory":"/home/freya/anaconda3/envs/***/",// conda虚拟环境中的路径// configuration is the path to conda's configuration file"configuration":"~/.condarc"}
激活环境
调出command palette: Ctrl+Shift + P
输入Conda,选择下拉列表中Activate Environment,再选中自己之前创建的环境就好啦
目前来看已经成为默认设置,不用每次打开进行激活
缺点就是结果显示在下方命令行中,运行需要用Ctrl+B,停止需要Tools-->Cancel build,不过是可以接受的。
禁用自动激活环境
conda config --set auto_activate_base false
启用自动激活环境
conda config --set auto_activate_base true