/ JUPYTER-NOTEBOOK, VSCODE, PYTHON

Installing a Python Library in Visual Studio Code - Windows

In this quick blogpost, I will share the steps that you can follow in order to install a Python library using pip through either the Terminal or a Jupyter Notebook in Visual Studio Code (VSCode) on a Windows computer.

Pre-requisites

In order to complete the steps of this blogpost, you need to install the following in your windows computer:

  • Visual Studio Code: you can find the steps to install it here.
  • Python Extension for Visual Studio Code: you can find the steps to install it here.
  • Python Interpreter: you can find the steps to install it here.

Installing a Python Library Using the Terminal in VSCode

1) Accessing Visual Studio Code Terminal

  • Open VSCode application

  • Go to the Terminal menu and select New Terminal.

  • A new terminal (PowerShell based) window is opened.

2) Importing a Python Library

  • Run the following command to validate that pip is installed in your computer.
    pip --version
    

  • Let us say that you want to install Pandas Python library.
  • Run the following command
    pip install pandas
    

  • Pandas library is now ready to be imported by any python application. You can repeat this process for any Python library.

Installing a Python Library Using a Jupyter Notebook in VSCode

1) Creating a Jupyter Notebook in VSCode

2) Importing a Python Library

  • Run the following command to validate that pip is installed in your computer.
    !pip --version
    

  • Let us say that you want to install Pandas Python library.
  • Run the following command.
    !pip install pandas
    

  • Pandas library is now ready to be imported by any python application. You can repeat this process for any Python library.