- Forums
- Scripts
- How To Start A Python Virtual Environment For Project With Vscode
We will get your project environment cleanly isolated inside C:\apps\bills using a Python Virtual Environment (venv). This keeps your project packages tidy and secure. [5390], Last Updated: Sun Sep 20, 2026
edw
Sun Sep 20, 2026
0 Comments
119 Visits
Follow these to create a virtual environment in python for a scrip project with vscode
- Open powershell terminal:
- Create the new project directory
$ mkdir -p G:\APPS\Python\MHUtilityBill
- Open the new folder with vscode
$ code G:\APPS\Python\MHUtilityBill
- In VSCode open the terminal
$ python -m venv venv
- (Give it a few seconds. You will see a new folder named venv appear inside your file explorer on the left).
- Activate the virtual environment:
$ .\venv\Scripts\Activate.ps1
- Install Your Dependencies, for example:
$ pip install pdfplumber python-dateutil

- Tell VS Code to Use Your Environment
- Press Ctrl + Shift + P to open the VS Code Command Palette
- Type
Python: Select Interpreter and click it.
- Choose the option that points to your new virtual environment. It will look something like:
Python 3.x.x ('venv': ./venv/Scripts/python.exe)
- Create Your Script File
- In the VS Code file explorer pane on the left, click the New File icon (or press Ctrl + N).
- Name the file
process_bill.py
- Paste the entire Python automation code block provided in the previous response into this file and save it (Ctrl + S).
- How to Run Your Script
python process_bill.py
Done