1、file => preferences =>setting 2、搜索python.pythonPath 3、设置workspace settings 中的python path为anaconda中的python命令的路径 如 "/anaconda3/envs/mlbook/bin/python" 4、这样我们打开一个py文件,就会自动切换到虚拟环境中