Select Installed Python Interpreter In Visual Studio Code. You can select which python interpreter to use by clicking the select python environment option on the bottom left corner of the visual studio code status bar. If you had used one python environment, you can click it to change to use another python.
- Setting Up Visual Studio Code for Python. It's now time for the exciting part! Go ahead and open the Visual Studio Code application. The first time you open the application (and after installing updates), you are greeted with information on new additions in the latest version. You can go ahead and close the two (or if you only have one) tabs.
- Write and run Python code using our online compiler (interpreter). You can use Python Shell like IDLE, and take inputs from the user in our Python compiler.
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
Add Python Interpreter To Visual Studio Code
- 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
Add Python Interpreter To Visual Studio 2017
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.
Subscribe to Open Threat Research Blog
Get the latest posts delivered right to your inbox