简体   繁体   中英

Change the default path to open Python3 in Sublime Text (OS X)

I use sublime text 3 to code my python script in OSX. However, whenever I create a new python script using sublime text 3 , it automatically created the file in Python2.7 . But I want to use Python 3.6 . This is really annoying and sabotaging my working progress...

Is there any way to change the default path for Python in sublime text 3 ? Appreciated!!

on mac os terminal type:

$ which python3

Add the path to cmd key of json in .sublime-build file

Just to expand on what was previously said. After you find the path of Python3 with the which command;

  • go to Tools--> Build System --> New Build System and paste the below into the file.

  • Replace PATH_TO_YOUR_PYTHON3 with your python3 path and save as "Python3.sublime-build". Now, Python3 should be an option to build with.

{
  "cmd": ["PATH_TO_YOUR_PYTHON3", "-u", "$file"],
  "file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
  "selector": "source.python"
}

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