Sublime Python Interpreter



Hi Python Developers, welcome to new post Sublime Run Python tutorial. Here we will learn how to run python programs on Sublime Text 3 editor, downloading and installing Sublime Text 3, installing packages and many more. So let’s move ahead.

There are various IDEs and Text editors are present to run python code. If you are a beginner then it’s ok to use text editor but if you are a developer then no doubt you will be familiar with the importance of IDEs. And you can also refer this link Best Python IDEs for a detailed explanation of Python IDEs . Although Sublime Text 3 is a text editor but it has some IDE-like functions, such as projects and “builds” to execute other programs from inside the editor.

Sublime Python is a step-by-step course for Python developers. You’ll learn how to set up a smooth and professional Python development environment on all of the major platforms (Windows, macOS, and Linux). These are some of the benefits that you’ll get from the course: Make your Python development environment fun again. Install Anaconda. Package Control - Install Package - Anaconda. Configure Anaconda. Preferences - Package Settings - Anaconda - Settings-User. Anaconda is a plugin that turns your SublimeText 3 into a rich featured Python development stack that boost your productivity and helps you to ensure the quality and style of your code. Configure Anaconda the Right Way. Anaconda works fine out of the box (always that there is a Python interpreter configured in your path and the binary is named python) but if you want to get the max from it, you can configure multitude of options to tune it and adapt it to your needs. To take a look at the common configuration of the Anaconda powerful IDE features, take a look at the Powerful. A Sublime Text package that include some build systems that use Docker Language Stacks. It currently build python, ruby, perl, c/c (gcc), clojure, go (golang), java, Dockerfile and Fig configuration files.

So now we will see some worthful informations about Sublime Text 3 editor.

Sublime Text 3 Editor – Start Programming With Sublime

Introduction

  • It is a light weight editor for developers.
  • It is most popular among developers.
  • The best thing of Sublime Text 3 is that it does not require much of installation space and working with it is very handy and comfortable.
  • Sublime Text 3.0 was released on 13 September 2017.
  • Jon Skinner and Will Bond are the developers of Sublime Text 3.
  • It natively supports lots of programming languages as well as markup languages.

Features Of Sublime Text 3

Cross Platform

  • Sublime Text 3 can run on Windows, Linux and Mac.
  • You have to need only one licence to use Sublime Text 3 on every computers on which you want to use Sublime Text 3, it doesn’t matter which OS they are using.

Powerful API and Package Ecosystem

  • Sublime Text 3 provides many powerful Python API that allows plugin to perform many built-in functionality.
  • Sublime Text exposes its internals via an Application Programming Interface (API) that programmers can interact with using the Python programming language.
  • An embedded Python interpreter is included in the editor. The embedded interpreter is useful to inspect the editor’s settings and to quickly test API calls while developing plugins.
Python

Goto Anything

  • It is the most powerful feature of Sublime Text 3.
  • This feature allows you to open files only with a few keystrokes.
  • It also allows you to instantly jump to symbols, lines or words.
  • For using this feature you have to press Ctrl+P button, then type – If you want to open a file then just type the part of file name, if you want to jump to symbols then type @, if you want to search anything within a file then simply type #, and now if you want to go to into a specific line number : .
  • For eg. if you type tp:100 that would take you to line 100 of the file.

Command Palette

  • This is an another powerful feature of Sublime Text 3.
  • It allows you to do various functionalities like sorting, syntax changing as well as changing identition settings.
  • Using command palette you can access a lots of things like handling sublime projects, changing file syntax, calling your package commands etc.
  • To use command palette – press ctrl+shift+p, then select command and press Enter.

Multiple Selections

  • It is one of the best feature of Sublime Text 3.
  • By using this feature you will be able to change multiple lines simultaneously and also can manipulate files faster.
  • It works as a quick substitute for find and replace, or to apply the same sequence of changes to multiple lines simultaneously.
  • To use Multiple Selection, select a block of text, then press Ctrl+Shift+L to split it into one selection per line and then press Ctrl+D to select the next occurrence of the selected word.

GoTo Definition

  • Sublime Text 3 introduced the most awaiting feature i.e. the “Goto Definition” functionality.
  • GoTo Definition uses the symbol index created by sublime text.
  • To use Go To Definition press alt+g .

Sublime Python Interpreter Path

Snippets

  • Snippets allows users to save blocks of frequently used code and assign keywords to them.
  • The user can then type the keyword and press tab to paste the block of code whenever they require it.

Run Sublime Python

Others Features

Apart from the above features Sublime Text 3 has also some other features like –

  • Spell check function
  • Auto save
  • Customizable key bindings
  • Macros
  • Split editing
  • Customize anything

So now we will discuss running python programs on Sublime Text 3.

Also Read : Run Python On Android – How To Run Python Programs On Android

Sublime Run Python Tutorial – Run Your First Program

No doubt Sublime text is the most loved text editor in the developer’s community and can serve as a great Python text editor. So now we will see how to use it for python.

Downloading And Installing

First of all you have to download it. The link for downloading is Sublime Text 3.

You will see a version description as follows –

And now you have to select one as your machine requirement. My machine is Windows-64 bit so i am downloading Windows-64 bit version.

And now install the downloaded file.

Setting Path

Once you have installed it then you have to set the path of python installation directory in environment variable. If your path is already set then you can skip this part otherwise follow this link Setting Path . As i have already set the path so i am skipping it.

Test A simple Program

Now we will see execution of python program on Sublime Text 3. For this what we have to do is that –

  • First of all open your sublime editor.
  • Create a new file by following steps File->New File or by pressing ctrl+N .
  • Then save this file as yourfilename.py . The extension must be .py .
  • Then write your code.

Here i am taking a simple program i.e., addition of two numbers. So code is –