The method of calling python3 by ctrl+B in sublime
This article will explain in detail the method of calling python3 by ctrl+B in sublime. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
The complete python3.exe path should be written in windowns system.
The following is the operation of macOS, similar to windows.
The python3 code is written in sublime text, but python2 is called by the ctrl + B runtime, resulting in an error in the run.
This is because many systems install python2 by default, and the version that calls python by default is python2.
Solution:
Let's start with a new sublime build system.
Then automatically opens a text, empties it, and writes the following:
{"env": {"PYTHONIOENCODING": "utf8"}, "cmd": ["/ Library/Frameworks/Python.framework/Versions/3.6/bin/python3", "- u", "$file"], "file_regex": "^ [] * File\" (. *?)\ ", line ([0-9] *)", "selector": "source.python"}
"env": {"PYTHONIOENCODING": "utf8"} is to avoid reporting errors in Chinese!
["/ Library/Frameworks/Python.framework/Versions/3.6/bin/python3", "- u", "$file"], here the path should be replaced with the path of python3 on your computer.
View the path of python3
$which python3/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Then, save the file name python3.sublime-build
Next, select python3
Let's verify that the current version is python3
Import sysprint (sys.version)
Press ctrl + B to run, and the result is as follows
3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08) [GCC 4.2.1 (Apple Inc. Build 5666) (dot 3)] [Finished in 0.1s]
Finish
This is the end of this article on "the method of calling python3 by ctrl+B in sublime". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.