在Mac OS系统下面更改Sublime REPL的默认Python版本

本文介绍了如何在Mac OS系统中将Sublime Text的SublimeREPL默认Python版本从2.7更改为3.8。通过修改`SublimeREPL/config/Python/Main.sublime-menu`文件,将`"python"`替换为`"python3"`,即可解决REPL运行Python代码时版本不一致的问题。
摘要由CSDN通过智能技术生成

使用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' 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值