简体   繁体   中英

Configure Sublime Text to use Python3

I added the following build script:

{
"cmd": ["/usr/local/bin/python3", "$file"]
, "selector": "source.python"
, "file_regex": "file \"(...*?)\", line ([0-9]+)"
}

when I run which python3 in terminal, i get the following: /usr/local/bin/python3 which tells me that I have the correct path in the Sublime file.

However, when i run

import sys 
print(sys.version)

i still get

2.7.10 (default, Feb  7 2017, 00:08:15) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]
[Finished in 0.1s]

I saved this new build system file under

Library/Application Support/Sublime Text 3/Packages/User/Python3.sublime-build

正如@KeithHall指出的那样,我实际上尚未选择新的构建系统。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM