mac 下 默认安装 python2, 自己安装 python3 之后, sublimerepl 运行 py 文件后发现 使用依旧是 2.** 版本
修改 Main.sublime-menu
配置文件更改如下(注意替换 python cmd 路径)
If you don't want to use virtualenv, create Packages/User/SublimeREPL/config/Python/Main.sublime-menu with the following contents:
which python3 # 可输出Python 路径
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
{"caption": "Python",
"id": "Python",
"children":[
{"command": "repl_open",
"caption": "Python 3",
"id": "repl_python3",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/opt/local/bin/python3", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{"command": "repl_open",
"caption": "Python 3 - IPython",
"id": "repl_python_ipython3",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": {
"osx": ["/opt/local/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"]
},
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {
"PYTHONIOENCODING": "utf-8",
"SUBLIMEREPL_EDITOR": "$editor"
}
}
}
]}
]
}]
}
]
# Test
import sys
print(sys.version)
# output
3.7.0 (default, Oct 2 2018, 09:20:07)
[Clang 10.0.0 (clang-1000.11.45.2)]
Refer: https://github.com/wuub/SublimeREPL/issues/264