Friday, December 27, 2024
Google search engine
HomeLanguagesHow to Setup Sublime Text 3 for Python in Windows?

How to Setup Sublime Text 3 for Python in Windows?

Written by a Google engineer sublime text is a cross-platform IDE developed in C++ and Python. It has basic built-in support for Python. Sublime text is fast and you can customize this editor as per your need to create a full-fledged Python development environment. You can install packages such as debugging, auto-completion, code linting, etc. There are also various packages for scientific development, Django, Flask, and so on.

Downloading and Installation

Sublime Text 3 can be downloaded from its official site sublimetext.com. To install sublime text 3 on Windows, go through How to install Sublime Text 3 in Windows?

Setting up Environment Variable

  • Step 1: Click the Advanced system settings link.
  • Step 2: Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.

  • Step 3: In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

Working on Sublime Text3

Step 1: Create a new file and save it with extension .py for example save it as checkversion.py. Now, Go to Tools -> Build System -> Python then type on your checkversion.py

This is showing the version of python. This means python is successfully installed and added in Environment Variable.

Step 2: Add new build system on your Sublime Tools -> Build System -> New Build System and make sure that the new build system has this following command




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


Select your new system build newPython3 and re-run the checkversion.py and now it should be using Python 3

ALL Done…
Now create any file and save it with .py extension

Now you can run your Python code by using CTRL+SHIFT+B and choose from the 2 options.

RELATED ARTICLES

Most Popular

Recent Comments