Follow these to create a virtual environment in python for a scrip project with vscode

  1. Open powershell terminal: 
  2. Create the new project directory
    $  mkdir -p G:\APPS\Python\MHUtilityBill
  3. Open the new folder with vscode
    $ code G:\APPS\Python\MHUtilityBill
  4. In VSCode open the terminal
    $ python -m venv venv
  5. (Give it a few seconds. You will see a new folder named venv appear inside your file explorer on the left).
  6. Activate the virtual environment:
    $ .\venv\Scripts\Activate.ps1
  7. Install Your Dependencies, for example:
    $ pip install pdfplumber python-dateutil
  8. Tell VS Code to Use Your Environment
    1. Press Ctrl + Shift + P to open the VS Code Command Palette
    2. Type Python: Select Interpreter and click it.
    3. Choose the option that points to your new virtual environment. It will look something like:Python 3.x.x ('venv': ./venv/Scripts/python.exe)
  9. Create Your Script File
    1. In the VS Code file explorer pane on the left, click the New File icon (or press Ctrl + N).
    2. Name the file process_bill.py
    3. Paste the entire Python automation code block provided in the previous response into this file and save it (Ctrl + S).
  10. How to Run Your Script
    1. python process_bill.py

Done