VOOZH about

URL: https://thenewstack.io/how-to-use-vs-code-for-python-and-why-you-should/

⇱ How To Use VS Code for Python (and Why You Should) - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2024-05-22 06:34:50
How To Use VS Code for Python (and Why You Should)
tutorial,
Python / Software Development

How To Use VS Code for Python (and Why You Should)

Why should you use VS Code for Python development? All the features, of course.
May 22nd, 2024 6:34am by Jack Wallen
👁 Featued image for: How To Use VS Code for Python (and Why You Should)
Feature image via Unsplash+.

Since I started my journey with Python, I’ve been working with nothing more than a Linux OS and a terminal window. Nano has been my editor of choice and it’s been fairly easy going. But there was always something bothering me: Nearly every developer I know uses an integrated development environment (IDE) to code.

That always surprised me because, when I was studying C++ in school way back when, I used that same combination of tools, partly because I couldn’t afford the software the instructor suggested.

On top of that, I didn’t have a machine running Windows, and Microsoft didn’t offer a version of their IDE for Linux.

That was a long time ago and things have changed considerably. I’m no longer constrained to the terminal window because there are plenty of GUI tools available for Linux, and some were created and distributed by Microsoft.

One of those tools is Visual Studio Code, which also happens to be one of the more popular IDEs on the market. In fact, VS Code comes in second on PYPL’s Top IDE Index behind Visual Studio, and has a 13.51% market share.

So I decided to give VS Code a try with Python and quickly discovered that it was a fantastic move.

But why? When a terminal window and nano were getting me by just fine, why would I bother with a more complicated GUI? Let me first talk about the why and then we’ll deal with the how.

Why You Should Use VS Code for Python

Essentially, it all boils down to features. Writing Python within the Linux terminal window (using nano) doesn’t really offer much. Sure, you do get syntax highlighting (so you can tell when you’ve left out a ” a ‘ or a ), but that’s about it. You don’t get automatic indentation and other helpful features found in an IDE.

Another big plus of using VS Code is the wealth of extensions available for Python. You’ll find extensions for debugging, indentation, environments, previews, Django, Intellicode (AI assistance), docstring generation, Jupyter Notebook support and much more. To access all of these features from the command line would require considerable work.

The truth of the matter is, you really won’t need any of these features until you’ve gone beyond the very basics of learning Python. At first, I would highly recommend sticking with a text-based editor and the Python interpreter. Because you’re dealing with rudimentary code, there’s no need for all the bells and whistles offered by VS Code.

However, as you gain more experience with Python, you might want to migrate to an IDE like VS Code.

With that in mind, let me show you how to get started with VS Code and Python.

What You’ll Need

I’m going to demonstrate this on Pop!_OS Linux, but you can install VS Code on macOS or Windows as well. For those two operating systems, the installation is as simple as downloading the installer file, double-clicking it and walking through the installation wizard.

For Linux, the process is a bit more challenging. Although you can download an installer file for APT and DNF package managers, you don’t receive automatic updates unless you download the latest version when it’s released and then reinstall.

With that in mind, let’s install VS Code on both Ubuntu and Fedora-based distributions.

Installing VS Code on a Ubuntu-Based Distribution

The first thing to do is to make sure that wget and gpg are installed on your machine. For that, issue the command:

sudo apt-get install wget gpg -y

Next, we download the official Microsoft GPG key:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg

We can now install the key with this command:

sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg

Create a new apt repository entry:

echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null

Install the necessary dependencies with this command:

sudo apt install apt-transport-https -y

Update apt:

sudo apt update

Finally, install VS Code with the command:

sudo apt install code -y

Install VS Code on a Fedora-Based Machine

First, install the required key:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

Create the dnf repository entry:

echo -e "\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null

Update dnf with this command:

dnf check-update

Install VS Code:

sudo dnf install code -y

Once you have VS Code installed, open it from your desktop menu and walk through the user-friendly onboarding wizard.

Enable Python Support

The next thing to do is enable Python support. For that, click the Extensions icon in the sidebar (which looks like the small Tetris-y icon, and can be found near the middle of the bar). In the resulting menu, type `python` and wait for the results. Click the Install button associated with the official Python extension. It should be the top result (refer to the image below).

👁 Image

Installing Python support in VS Code.

Once the extension is installed, you can then scroll through the remaining results and install any other Python-related extensions you might want. With that taken care of, you can then open a folder on your machine (select File > Open Folder) that contains your existing Python code. Your files will be listed in the left sidebar. Open one of your files and and continue working with it. For example, I'll open a file from my Typecasting tutorial. The code appears in the editor. I can then click the Run button (a right-pointing arrow found near the top-right of the window). A pane will open below the editor, and the code will run.

One additional bonus that I didn't mention earlier is that VS Code provides quick access to all of the files found in your selected folder. You won't have to remember the name of what you've created and open it manually. That's a small addition that can make a big difference in efficiency.

If you're starting to get the hang of Python, I'd highly recommend that you add an IDE like VS Code into the mix. You'll enjoy the added power and efficiency.

TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
Microsoft is a sponsor of The New Stack.
TNS owner Insight Partners is an investor in: Enable.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.