Fundamentals 5 min read

How to Install VS Code on Ubuntu and Run Your First Python Script

This step‑by‑step guide shows how to install Python and VS Code on Ubuntu, configure the Python extension, create a simple project, write a hello‑world script, and run it directly from the VS Code IDE.

21CTO
21CTO
21CTO
How to Install VS Code on Ubuntu and Run Your First Python Script

Install Prerequisites

First, install the full Python package on Ubuntu: sudo apt-get install python3-full -y After Python is installed, download the VS Code .deb package from the official website, locate it in the Downloads folder, and install it either by double‑clicking or via the command line:

cd ~/Downloads
sudo dpkg -i *.deb

Configure VS Code with Python

Create a project directory, open it in VS Code, and install the Python extension.

mkdir project
cd project
code .

In VS Code press Ctrl+Shift+P, run “Python: Create Environment”, choose venv, and select the latest interpreter. Then create a new file hello.py with the following content:

msg = "Hello, New Stack!"
print(msg)

Save the file (Ctrl+S) and run it by clicking the play button; the output “Hello, New Stack!” appears in the terminal.

Congratulations, you have created and run your first Python application in VS Code on Linux.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PythonLinuxTutorialIDEVS CodeUbuntu
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.