- Close all instances of VS Code; Next, launch VS Code from that same terminal (command window) session (venv) ter @minal: $ code. Python Version used for debugging. Details on configuration settings for debugging can be found here Debugging. Configuring the version of the python executable is no longer necessary.
- Working with Python in Visual Studio Code, using the Microsoft Python extension, is simple, fun, and productive. The extension makes VS Code an excellent Python editor, and works on any operating system with a variety of Python interpreters. It leverages all of VS Code's power to provide auto complete and IntelliSense, linting, debugging, and unit testing, along with the ability to easily switch between Python.
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
This video tutorial explains how to update PIP version from Visual Studio Code in few steps. You can easily upgrade pip version using visual studio code by d.
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 selectNew 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.
- Let us say that you want to install
Pandas
Python library. - Run the following command
- 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
- Create a Jupyter Notebook following the steps of My First Jupyter Notebook on Visual Studio Code (Python kernel)
2) Importing a Python Library
- Run the following command to validate that pip is installed in your computer.
- Let us say that you want to install
Pandas
Python library. - Run the following command.
- Pandas library is now ready to be imported by any python application. You can repeat this process for any Python library.
Visual Studio Code Python Install
Subscribe to Open Threat Research Blog
Visual Studio For Python
Get the latest posts delivered right to your inbox