Choosing an editor or IDE for Python Programming

Editor or IDE for Python Programming

There are a lot of great tools out there for working with the Python programming language, but in this course I’m going to be using Visual Studio Code. It has great support for Python editing, it’s free, and it runs on Mac, Windows, and Linux. It also has a wide variety of plugins available, which will help when working with Python. If you want to use VS code along with me in this course, then download and install it from code.visualstudio.com. Once you have it installed, launch it and then click on the extensions icon.



Visual Studio

So here in my copy of Visual Studio Code I’m going to go to the Extensions panel, and then here in the search box type in the word Python. So the extension that you’re looking for is this one here made my Microsoft.




Now, I’ve already got it installed and you can see that it has a great rating and a large number of downloads. Now, it’s not absolutely necessary for you to use this plugin, but I like it because it adds support for debugging and running Python apps right from within VS code. So once you have the extension installed, restart VS Code and then open the folder for the exercise files.



So I’ll open the folder here and it’s on my desktop. In my desktop I’m going to choose Exercise Files. Okay, once I have the exercise files open I’m going to click on the debug icon and in here you can see it says No Configurations. What I’m going to do is click on the gear icon, I’m going to choose the Python environment, and this will bring up a launch.json settings file. In this file I’m going to change the value of this CWD property right here under the Python configuration to be an empty string.

Debugger

This will ensure that the debugger points at the same directory where the Python script is being run from. Now there’s one other change that you might have to make on your computer. It turns out that on my particular Mac I have both Python 2.7 and Python 3.6 running. So I need to make sure that the debugger is pointing at the right version of Python. So I’m going to go up here into the Code menu and choose Settings, and I’m going to do a search on Python path.




And you can see right here that this is the path to Python. So python.pythonPath is currently pointing to the term Python, but on my computer that runs Python 2.7. I want to make sure that we’re running Python 3. So I’m going to edit this setting and copy it over to my VS code settings, and I’m going to change this to, instead of executing the Python command it’s going to execute the Python 3 command. Again, if this is only going to be relevant to you if you have multiple installations of Python on your computer.

So you might have to do this depending on weather you’ve got Python 2 as well as Python 3 installed. So I’ll go ahead and save this and then close both. So once you’ve got your tools set up then you’re ready to proceed.



Hamza Arif
Follow us

Hamza Arif

Hey, i hamza arif student of telecommunication from BZU, i am good in Networking, Telecommunication and Web Development working on different projects and try my best to teach them to all of you.
Hamza Arif
Follow us

Leave a comment

Your email address will not be published. Required fields are marked *