您好,当我在python中使用sublime文本3时,比如说2.7.13,如何让构建在每次运行python脚本时都输出python版本?
我可以通过在设置文件中添加命令来做到这一点吗?
当前设置为(Python.sublime build)
{ "shell_cmd": "python -u \"$file\"", "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python", "env": {"PYTHONIOENCODING": "utf-8"}, }
可能最简单的方法是修改构建以使其运行 python 两次,一次用于打印版本,另一次用于实际执行脚本:
python
{ "shell_cmd": "python --version && python -u \"$file\"", "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python", "env": {"PYTHONIOENCODING": "utf-8"} }