2016年3月23日 星期三

[python] build python3.4 under sublime text3; Ubuntu and windows

Go to sublime-text3
=>Tools =>build system =>New build system

past below content! and accroding your python ver

to change the command /usr/bin/env python3.x
#Mac
{
"cmd": ["/Library/Frameworks/Python.framework/Versions/3.4/bin/python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}

#Ubuntu
{
    "shell_cmd": "/usr/bin/env python3.4 ${file}",
    "selector": "source.python",
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "working_dir": "${file_path}",
}

or

#Windows

{
    "cmd": ["C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python35-32\\python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}



=========================
reopen sublime
go to build system, select ptyhon3.4 which the name you saved above
ctrl+B (Build)

=====================================

you can test it by

import sys
print("python ver.:" ,sys.version)
print sys.path #2.x is OK, because print is command at that time.
print (sys.path) #3.x is ok, print change to function.

沒有留言:

張貼留言