Two methods to run python script

2018-03-07  本文已影响0人  cutelittlePanda

Method 1: using 'Command line' pop-up window

cmd -> python name_python_script.py

Method 2:   config sublime text, and run the .py script within it's framework.

1). open 'sublime text' --> Tools --> Build System ... -->New Build System ...

2). copy text below, and then save it with the name of 'python3' :

{

"env": { "PATH":"F:/programFiles/python3.6.1/python.exe;%PATH%" },

"shell_cmd": "python -u \"$file\"",

"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",

"selector": "source.python",

//"encoding": "cp936"

"encoding": "utf-8"

}

3). restart sublime text, and then navigate to 'Tools --> Build System... --> select 'python3' '

4). open .py script in sublime text, then select 'Tools --> Build' to run it.

Done!!!

上一篇 下一篇

猜你喜欢

热点阅读