Welcome to your Python development setup guide! By the end of this, you'll have a professional Python development environment.
- β Python installed and working on your computer
- β VSCode (Visual Studio Code) as your code editor
- β Essential VSCode extensions for Python
- β A test Python program to verify everything works
- β Tips for an efficient coding workflow
Open your terminal/command prompt and type:
python --version
# or
python3 --versionIf you see something like Python 3.11.0, you might already have Python! Skip to Step 2.
- Go to: python.org/downloads
- Download: The latest version (should be Python 3.11+ or newer)
- IMPORTANT: During installation, check "Add Python to PATH" β
- Download from python.org
- Run the installer
- β CHECK: "Add python.exe to PATH" (very important!)
- Click "Install Now"
- Verify: Open Command Prompt and type
python --version
Option 1: From python.org (Recommended)
- Download from python.org
- Run the installer package
- Follow installation wizard
Option 2: Using Homebrew
# Install Homebrew first (if needed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Python
brew install pythonMost Linux distributions come with Python. If not:
Ubuntu/Debian:
sudo apt update
sudo apt install python3 python3-pipCentOS/RHEL/Fedora:
sudo dnf install python3 python3-pip- Go to: code.visualstudio.com
- Download: Click the big download button for your OS
- Install: Run the installer with default settings
- Open: VSCode
- Skip: The welcome tutorial for now (you can always come back)
- Theme: Choose your preferred theme (Dark+ is popular with developers)
Extensions make VSCode super powerful for Python development!
- Open VSCode
- Click: Extensions icon (left sidebar) or press
Ctrl+Shift+X - Search and Install these extensions:
- Python (by Microsoft) - Main Python support
- Pylance (by Microsoft) - Advanced Python language server
- Python Debugger (by Microsoft) - Debugging support
- indent-rainbow - Makes indentation visible (helpful for Python!)
- Bracket Pair Colorizer - Colors matching brackets
- GitLens - Enhanced Git capabilities
- Better Comments - Improved comment formatting
- Error Lens - Shows errors inline
- Material Icon Theme - Better file icons
Press Ctrl+Shift+P (or Cmd+Shift+P on Mac), type "Extensions: Install Extensions" and paste these one by one:
ms-python.python
ms-python.vscode-pylance
ms-python.debugpy
oderwat.indent-rainbow
aaron-bond.better-comments
eamodio.gitlens
- Open VSCode
- Press:
Ctrl+Shift+P(Command Palette) - Type: "Python: Select Interpreter"
- Choose: The Python version you installed (usually shows the path)
Press Ctrl+, to open settings, then search for and configure:
{
"python.defaultInterpreterPath": "python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "autopep8",
"python.autoComplete.addBrackets": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"editor.fontSize": 14,
"editor.minimap.enabled": true,
"editor.wordWrap": "on"
}- Create folder: Make a new folder called
python_teston your desktop - Open in VSCode: File β Open Folder β Select your
python_testfolder - Create file: Right-click in Explorer β New File β
hello.py
Add this code to hello.py:
# This is a test Python program
def greet(name):
"""
This function greets a person
"""
print(f"Hello, {name}! Welcome to Python programming!")
print(f"Python is working correctly on your system! π")
def main():
# Test basic Python features
print("=" * 50)
print("π PYTHON SETUP TEST π")
print("=" * 50)
# Variables and data types
name = "Python Programmer"
version = 3.11
is_awesome = True
# Function call
greet(name)
# List and loop
languages = ["Python", "JavaScript", "Java", "C++"]
print(f"\nPopular programming languages:")
for i, lang in enumerate(languages, 1):
print(f"{i}. {lang}")
# Dictionary
info = {
"language": "Python",
"version": version,
"awesome": is_awesome
}
print(f"\nCurrent info: {info}")
# Mathematical operations
result = 2 ** 10
print(f"\n2^10 = {result}")
print("\nβ
If you can see this, Python is working perfectly!")
print("π You're ready to start coding!")
if __name__ == "__main__":
main()- In VSCode: Press
F5orCtrl+F5to run - Or use terminal: Open terminal in VSCode (
Ctrl+`) and type:python hello.py
If everything works, you should see:
==================================================
π PYTHON SETUP TEST π
==================================================
Hello, Python Programmer! Welcome to Python programming!
Python is working correctly on your system! π
Popular programming languages:
1. Python
2. JavaScript
3. Java
4. C++
Current info: {'language': 'Python', 'version': 3.11, 'awesome': True}
2^10 = 1024
β
If you can see this, Python is working perfectly!
π You're ready to start coding!
Ctrl+F5: Run without debuggingF5: Run with debuggingCtrl+Shift+P: Command Palette (your best friend!)Ctrl+`: Toggle terminalCtrl+/: Comment/uncomment lineAlt+Up/Down: Move line up/downCtrl+D: Select next occurrence of wordF12: Go to definition
- IntelliSense: Auto-completion as you type
- Error Squiggles: Red underlines show errors
- Debugger: Set breakpoints by clicking line numbers
- Integrated Terminal: Run Python directly in VSCode
- Git Integration: Built-in version control
- Linting: Automatic code quality checks
- Formatting: Auto-format code on save
- Testing: Run unit tests directly in VSCode
- Debugging: Step through code line by line
Python comes with pip (Python Package Installer). Test it:
# Check pip version
pip --version
# Install a useful package
pip install requests
# List installed packages
pip list
# Create requirements file (for sharing dependencies)
pip freeze > requirements.txtYou now have a professional Python development environment! π
- β Python installed and working
- β VSCode configured for Python development
- β Essential extensions installed
- β Test program running successfully
- β Ready for the CDAC Python course!
- Return to: Main README
- Set up: Git and GitHub
- Fork: The course repository
- Start: Your coding journey!
β "python: command not found"
- Windows: Python wasn't added to PATH during installation. Reinstall and check "Add to PATH"
- Mac/Linux: Try
python3instead ofpython
β "VSCode doesn't recognize Python"
- Solution: Press
Ctrl+Shift+Pβ "Python: Select Interpreter" β Choose your Python installation
β "Extensions not working"
- Solution: Restart VSCode after installing extensions
β "Import errors in VSCode"
- Solution: Make sure you've selected the correct Python interpreter
β "Code runs in terminal but not in VSCode"
- Solution: Check your Python interpreter setting in VSCode
- Ask: Harshal or classmates
- Check: VSCode Python documentation
- Search: Stack Overflow for specific issues
π Happy Coding! You're now equipped with industry-standard tools used by professional developers worldwide!