![]() Sublime doesn’t support that without further setup work. ![]() If you’re planning on running any code that uses something like input() or anything where as a part of your program you’re going to need to give some sort of input to your program, it’s not going to work. But you always have to save at least once first). Once you save the file once and it has a name, as long as Tools > Save all on build is checked, you never have to worry about it again (otherwise, save before building every time unless you want surprises. If you don’t, you’re going to get weird errors the first time. So you need to make sure that your file is saved on disk. Sublime is executing an external program (in this case python/ python3) to do the work. If you ever need to change it, use Tools > Build With instead of Tools > Build and it will ask you again. This box will only appear once Sublime will remember your choice. Pick the entry that’s named for the name of your file, not the one that says - Syntax Check that will compile your program and not run it. You’re going to be offered a panel with several options (depending on whether chose Automatic or not above). py extension) when you use Tools > Build or the associated key, a build will trigger. Now in a Python file (Sublime has to know it’s Python, so save the file to disk as a. Don’t pick Python here that will get you the default build (you chose a different name above to ensure that it would be easy to determine which one is yours). Now you want to go to Tools > Build System in the menu and either select Automatic or the item with the name that represents the file that you just saved. (note: You don’t need to try to throw any path information in there such as is suggested in that link, unless your system isn’t set up correctly just literally changing python to python3 in those two lines should be enough). What you put here depends on what you need to type in a terminal in order to execute Python 3. Now that you have a duplicate build system, in both of the shell_cmd lines, replace python with python3 (or whatever the name of your interpreter is). It should also be in your User package, but if you follow these steps, Sublime will store it there by default. Make sure the file you save as the sublime-build extension. Name it something like Python3.sublime-build or My Custom Python.sublime-build, etc (basically anything other than Python.sublime-build. Sublime’s going to ask you what you want to name the file. Select all of the text and paste in the text you copied above, then do a save. from the menu, which will create a new unsaved window with a Stub build system in it. Now choose Tools > Build System > New Build System. Once it’s open, select everything and copy it to the clipboard (you can’t edit this file). Use View Package File from the command palette to open the file Python/Python.sublime-build this is the build system that ships with Sublime by default.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |