Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of calling python3 by ctrl+B in sublime

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report