使用REPL的时候,发线默认的Python版本为2.7,查看方法为Tools–>SublimeREPL–>Python–>Python
WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.
Python 2.7.16 (default, Feb 29 2020, 01:55:37)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
而自己系统本身默认的版本为Python3.8;
luyaodeMacBook-Pro:~ luyao$ python
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
用com+B运行程序的时候sublime是用Python3.8运行的,而使用REPL的时候,则是用Python2.7进行运行的,所以导致了一些代码无法正常的运行。
File "bicycles.py", line 4
SyntaxError: Non-ASCII character '\xe7'