DEV Community

Cover image for How to Set Up a Python Development Environment (VS Code + Git)
MD SAIDUL ISLAM
MD SAIDUL ISLAM

Posted on

How to Set Up a Python Development Environment (VS Code + Git)

๐Ÿš€ How to Set Up a Python Development Environment (VS Code + Git)

So, youโ€™ve decided to learn Pythonโ€”great choice! ๐ŸŽ‰ Now, letโ€™s set up a proper coding environment to write, test, and manage Python projects efficiently.

Today, weโ€™ll cover:
โœ… Installing Python
โœ… Setting up VS Code for Python
โœ… Installing Git for version control
โœ… Running your first Python script

Letโ€™s get started!๐Ÿš€

1๏ธโƒฃ Install Python

First, you need to install Python on your system.

๐Ÿ”น Download Python from the official site:
๐Ÿ‘‰ Python Official Download

๐Ÿ”น For Windows:

  1. Download and run the installer.

  2. Check "Add Python to PATH" before clicking "Install".

  3. Open Command Prompt and type:

python --version

If it shows the Python version, youโ€™re good to go! โœ…

๐Ÿ”น For Mac/Linux:

Use Homebrew on Mac:

brew install python3
Enter fullscreen mode Exit fullscreen mode

On Linux (Debian/Ubuntu):

sudo apt install python3
Enter fullscreen mode Exit fullscreen mode

2๏ธโƒฃ Install VS Code (Visual Studio Code)

Why VS Code?
โœ”๏ธ Lightweight & Fast
โœ”๏ธ Supports Python Extensions
โœ”๏ธ Built-in Terminal & Git Support

๐Ÿ”น Download & install VS Code:
๐Ÿ‘‰ VS Code Official Site

๐Ÿ”น Set Up Python in VS Code:

  1. Open VS Code and install the Python Extension

  2. Press Ctrl + Shift + P โ†’ Type Python: Select Interpreter โ†’ Choose Python 3.x

  3. Open a folder, create a .py file, and start coding!

3๏ธโƒฃ Install & Set Up Git for Version Control

Version control helps you track changes in your code. Git is the most popular tool for this!

๐Ÿ”น Download Git:
๐Ÿ‘‰ Git Official Site

๐Ÿ”น Basic Git Setup (After Installation)
Open a terminal and set up your identity:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

๐Ÿ”น Check if Git is Installed:

git --version
Enter fullscreen mode Exit fullscreen mode

If you see the version number, Git is ready! โœ…

4๏ธโƒฃ Run Your First Python Script

Now, letโ€™s write and run your first Python script in VS Code.

๐Ÿ”น Open VS Code, create a file named hello.py
๐Ÿ”น Write this simple code:

print("Hello, World! Welcome to Python Development!")
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”น Run the script by clicking Run โ–ถ๏ธ or using the terminal:

python hello.py
Enter fullscreen mode Exit fullscreen mode

Congrats! ๐ŸŽ‰ Youโ€™ve successfully set up Python, VS Code, and Git!

Top comments (0)