How to install a new python module on VSCode? How to install a new python module on VSCode? python-3.x python-3.x

How to install a new python module on VSCode?


You should open the terminal inside the VSCode and install the modules you want.something like👇

VSCode Snapshot

if that's not you meant, please let me know.


  1. First of all I would advise you to select the current Python version you have. It has been explained here:

VSCode: There is no Pip installer available in the selected environment

  1. Next, you should check is the pip installed in your Python main directory or not, by checking how to do on this website:

https://pip.pypa.io/en/stable/installing/

or this thread

How to use pip with Visual Studio Code

by typing

   py -m pip

in your terminal, like

   C:\Users\m\Desktop\Python> py -m pip

You should have the list of commands and general options which can be used. One of them is install

On the Python library platform, you always have the command to be copied in order to the installation of package you want.

enter image description here

  1. In your terminal, the initial command should look as:

       PS C:\Users\m\Desktop\Python> py -m

to which you should append the command prepared on the Python library platform (by copying it and pasting).

   C:\Users\m\Desktop\Python> py -m pip install openpyxl

That's it. The package should be installed in your Python folder, what you will see in the terminal.

  1. If everything is alright, you just need to type

    import openpyxl     #or other package name, which you downloaded

and use it!