Python & Web Dev Basics (2 Part Series)
1 Why Python is the Best Programming Language for Beginners
2 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:
-
Download and run the installer.
-
Check “Add Python to PATH” before clicking “Install”.
-
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:
-
Open VS Code and install the Python Extension
-
Press Ctrl + Shift + P → Type Python: Select Interpreter → Choose Python 3.x
-
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 “youremail@example.com“
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!
Python & Web Dev Basics (2 Part Series)
1 Why Python is the Best Programming Language for Beginners
2 How to Set Up a Python Development Environment (VS Code + Git)
原文链接:How to Set Up a Python Development Environment (VS Code + Git)
暂无评论内容