How to pip install Python Modules in VSCode

VSCode pip command example

If you have a Python project that you are working on in VS Code and want to import a module using pip, follow the below steps,

  1. Open Terminal,
  2. Create Virtual Environment (.venv),
    Mac/Linux: python3 -m venv .venv
    Windows: py -3 -m venv .venv
  3. Press yes when you see the notice: "We noticed a new virtual environment has been created. Do you want to select it for the workspace folder?"
  4. Now you can install Python modules using pip (pip3) command.

Have Questions? Post them here!