Reputation: 435
I'm trying to install new python modules on my computer and I know how to install through the terminal, but I wish to know if there is a way to install a new module directly through VSCode (like it is possible on PyCharm)?
I already installed through the terminal, it isn't a problem, but I want to install without be obligate to open the terminal when I'm working on VSCode.
Upvotes: 22
Views: 193723
Reputation: 21
Installing using the 'pip' from within python worked for me.
On the vscode terminal type in python and goto the python prompt
At python prompt:
import pip
pip.main(['install', "pandas"]) #this will install pandas in the current environment.
quit python prompt and return to vscode terminal.
Upvotes: 1
Reputation: 1456
VSCode: There is no Pip installer available in the selected environment
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.
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.
If everything is alright, you just need to type
import openpyxl #or other package name, which you downloaded
and use it!
Upvotes: 10
Reputation: 263
You should open the terminal inside the VSCode and install the modules you want. something like👇
if that's not you meant, please let me know.
Upvotes: 13