is only for environment preparation. Python includes many modules in its Standard Library, while pyodbc, pandas, openpyxl and PyInstaller are external packages that must be installed separately. By the end of this lesson, VS Code, Python, the terminal, the Python extension and all required libraries should be ready for later project work.
Python Setup for Industrial Automation Learners
This tutorial stops at environment setup and library verification. SQL Server coding, Excel report generation and EXE creation are separate later practicals.
Related Search Topics
install VS Code for Python · VS Code Python terminal · Python Standard Library · install pyodbc pandas openpyxl · check Python libraries installed
1. Architecture: VS Code → Python → Extension → Terminal → Libraries
Python Setup in VS Code
Code-rendered architecture for automation learners — every box below is live HTML/CSS text, not an image.
Install VS Code
Code editor for writing and managing Python files.
Visual Studio Code
Install Python
Interpreter that actually executes your .py program.
Add Python Extension
Connects VS Code tools with the selected Python interpreter.
Python Extension
Open VS Code Terminal
Run Python, pip and later automation scripts from one place.
python -m pip list
Check Python & pip
Confirm that interpreter and package installer are responding.
python -m pip --version
from pathlib import Path
import os
import json
pyodbc pandas openpyxl pyinstaller
Architecture concept: editor → interpreter → extension → terminal → built-in modules → external packages → verified development environment.
For , separate the development environment into five layers. VS Code is the editor, Python is the interpreter, the Microsoft Python extension adds Python-aware tools, the integrated terminal runs commands, and libraries provide reusable capabilities for later automation projects.
2. How to Install Visual Studio Code on Windows
Download VS Code
Open the official Visual Studio Code download page: code.visualstudio.com/download. For most individual Windows learners, the VS Code documentation recommends the User Setup.
Run the installer
Start the downloaded VSCodeUserSetup-...exe, accept the license, and complete the installation. User Setup normally installs VS Code under your Windows user profile.
Open VS Code
Launch Visual Studio Code. You now have the editor, but Python code still requires a Python interpreter.
3. Install Python and Verify It
Download Python from the official Python website: python.org/downloads. On Windows, enable the installer option that makes Python available from the command line when offered, then complete the installation.
Verify Python
Open the VS Code terminal using Terminal → New Terminal and run:
python --version
You can also verify pip:
python -m pip --version
python starts the interpreter; -m pip tells that interpreter to run the pip package installer module.python -m pip ... reduces confusion because pip runs through that Python interpreter.| Command | Purpose on |
|---|---|
python --version | Confirm which Python interpreter is available. |
python -m pip --version | Confirm pip is available for the same Python interpreter. |
python -m pip list | View packages installed in the selected environment. |
python test.py | Run a Python file from the terminal. |
cd D:\FolderName | Change the terminal working folder when required. |
cls | Clear the Windows terminal screen. |
The integrated terminal is where learners verify Python, install external packages with pip, run Python files and inspect the current environment. Open it using Terminal → New Terminal or the keyboard shortcut Ctrl+`.
4. VS Code Terminal: Your Main Command Area
5. How to Use Python as an Extension in VS Code
Open Extensions
Click the Extensions icon on the left side of VS Code or press Ctrl+Shift+X.
Install “Python” by Microsoft
Search for Python and install the Microsoft Python extension. It provides Python editing, IntelliSense integration, debugging, testing and interpreter selection.
Select the Interpreter
Press Ctrl+Shift+P, run Python: Select Interpreter, and select the Python installation you want this project to use.
Create Your First File
Create test.py and enter:
print("Python is working in VS Code")Run it using the Run Python File control or the terminal command python test.py.
6. Library, Package and Module: What Do These Words Mean?
Beginners often use the word library for all reusable Python code. That is acceptable in normal conversation, but the technical terms are useful:
| Term | Meaning | Example |
|---|---|---|
| Standard Library | Large collection of modules/packages supplied with Python | datetime, pathlib, csv, json |
| Module | A reusable unit of Python code, commonly represented by one module file or built-in module | datetime, math |
| Package | A structured collection of Python modules/subpackages | pandas, openpyxl |
| External / Third-party Package | Reusable Python software installed separately from Python | pyodbc, pandas, PyInstaller |
| Import | Statement that makes a module/package or selected name available in your program | import pyodbc |
7. Important Python Standard Library Modules and Applications
These modules normally require no separate pip installation because they are supplied with Python.
| Module | Main application | Industrial/reporting example |
|---|---|---|
datetime | Date and time | Timestamp an Excel report filename |
pathlib | File and folder paths | Create D:\SQF_Reports and build output paths |
os | Operating-system interaction | Environment variables, folders and process-related tasks |
sys | Python runtime/system information | Exit codes, command-line behavior and interpreter information |
csv | CSV file reading/writing | Simple production-data interchange |
json | JSON encoding/decoding | REST API and Industry 4.0 payload handling |
logging | Application logs | Record report generation and connection errors |
math | Mathematical functions | Engineering calculations |
statistics | Basic statistics | Mean, median and process summaries |
subprocess | Start external programs/commands | Launch supporting utilities from an automation script |
time | Timing and delays | Polling intervals and simple timed execution |
Standard Library Import Examples
from datetime import datetime
from pathlib import Path
import csv
import json
import logging
import os
import sys
8. Important External Libraries for Automation Applications
| External package | Application | Why useful in automation |
|---|---|---|
pyodbc | ODBC database connectivity | Connect Python to Microsoft SQL Server |
pandas | Tabular data processing | Build and transform DataFrames before reporting |
openpyxl | Excel .xlsx workbooks | Format headers, filters, date formats, widths and cells |
PyInstaller | Application packaging | Create distributable Windows executables from Python scripts |
numpy | Numerical arrays/calculation | Large numerical/process-data calculations |
requests | HTTP/REST communication | Send or receive data through REST APIs |
matplotlib | Charts and plots | Generate process and reporting graphs |
9. How to Install External Python Libraries
Open the VS Code terminal. For , install the external packages required by the later SQL Server → Excel → EXE project:
Optional first check — update pip
python -m pip install --upgrade pip
python -m pip install pyodbc pandas openpyxl pyinstaller
Check the installed packages:
python -m pip show pyodbc
python -m pip show pandas
python -m pip show openpyxl
python -m pip show pyinstaller
Or see the complete environment:
python -m pip list
pyodbc is the Python package. It does not install Microsoft’s ODBC Driver for SQL Server. Your Windows computer must also have the required ODBC driver, such as the driver name configured in your connection string.10. Project Environment Readiness Test
This is the only copy-paste Python code required on . It does not connect to SQL Server, read plant data, create Excel files or build an EXE. Its purpose is only to confirm that Python and the libraries required by the later project can be imported successfully.
Create _library_check.py
from datetime import datetime
from pathlib import Path
import sys import pyodbc
import pandas as pd
import openpyxl
import PyInstaller print("=== SOFTWELL PYTHON READINESS CHECK ===") # Python interpreter
print("Python :", sys.version.split()[0]) # Standard Library checks
print("datetime : OK -", datetime.now().strftime("%d-%m-%Y %H:%M:%S"))
print("pathlib : OK -", Path.cwd()) # External package checks
print("pyodbc :", getattr(pyodbc, "version", "Installed"))
print("pandas :", pd.__version__)
print("openpyxl :", openpyxl.__version__)
print("PyInstaller :", PyInstaller.__version__) # Windows ODBC driver check for later SQL Server practical
odbc_drivers = pyodbc.drivers()
print("ODBC Drivers :", odbc_drivers) sql_server_drivers = [ driver for driver in odbc_drivers if "SQL Server" in driver
] if sql_server_drivers: print("SQL ODBC Driver : READY -", sql_server_drivers[-1])
else: print("SQL ODBC Driver : NOT FOUND") print("=== LIBRARY CHECK COMPLETE ===")
Run the readiness check
python _library_check.py
ModuleNotFoundError, display versions for pandas, openpyxl and PyInstaller, and list a SQL Server ODBC driver for the future pyodbc database lab.If a module is missing
python -m pip install pyodbc pandas openpyxl pyinstaller
If Python reports that the packages are installed but VS Code still cannot import them, re-check Python: Select Interpreter and confirm the VS Code terminal is using the same Python environment.
11. Important Comparison Tables
Standard Library vs External Library
| Point | Standard Library | External / Third-party |
|---|---|---|
| Comes with Python | Yes | No |
| Usually requires pip | No | Yes |
| Example | datetime, pathlib, json | pyodbc, pandas, openpyxl |
| Main purpose | General Python capabilities | Specialized capabilities maintained outside core Python |
| Import syntax | import json | import pyodbc |
VS Code vs Python vs Python Extension
| Component | What it is | What it does |
|---|---|---|
| VS Code | Code editor | Edits files, manages folders, terminals and extensions |
| Python Interpreter | Runtime | Actually executes Python code |
| Python Extension | VS Code extension | Adds Python-aware editing, debugging, environment selection and tooling integration |
| pip | Package installer | Installs external Python packages into an environment |
Import vs Install
| Command | Meaning |
|---|---|
python -m pip install pyodbc | Install the external package into the selected Python environment |
import pyodbc | Load the installed package for use in the current program |
from pathlib import Path | Import the Path class from a Standard Library module; no pip install normally required |
Recommended Learning Order
- Python Modules, Classes and Objects — understand the terminology first.
- Python Setup in VS Code: Installation, Extensions, Libraries & pip — prepare the complete Python environment.
- Python Data Types for SQL Server Integration.
- Create SQL Server Database Using Python.
- Read SQL Server Data with Python.
- Generate Excel Reports from SQL Server.
- Create EXE for Excel Report Generation.
Frequently Asked Questions
What is the difference between Python Standard Library and external libraries?
Standard Library modules are supplied with Python, while external packages such as pyodbc, pandas, openpyxl and PyInstaller are installed separately, normally with pip.
Does the VS Code Python extension install Python?
No. VS Code, the Microsoft Python extension and the Python interpreter are separate components. Install Python separately, then select the interpreter in VS Code.
Which external libraries should we install on ?
For the later Softwell SQL Server, Excel and EXE project, install pyodbc, pandas, openpyxl and PyInstaller. is only installation and verification.
How do I check that all libraries are ready?
Run the readiness test. It imports every required package, prints package versions and lists the ODBC drivers visible to pyodbc.
Why use python -m pip instead of only pip?
It explicitly runs pip through the selected Python interpreter, which helps reduce environment mismatch between VS Code, Python and installed packages.
Does pyodbc install the Microsoft ODBC Driver for SQL Server?
No. pyodbc is the Python package. The Microsoft ODBC Driver for SQL Server is a separate Windows driver and is checked now because it will be required in the later database practical.
