Dhruvik
Dhruvik

Reputation: 33

Python modules in visual studio code

How to download python modules in visual studio code? I have tried to download using pip but vs-code uses windows cmd/PowerShell therefore pip didn't work.

Upvotes: 0

Views: 6978

Answers (1)

Brett Cannon
Brett Cannon

Reputation: 16090

Your best solution is to create a virtual environment for your project and then install into that. So if you're on Windows and don't have access to pip then you probably used the python.org installer and don't have python3 on your path either. In that case you can do py -m venv .venv to create a virtual environment (this is assuming you're using Python 3). Once that's created you will want to select the virtual environment (see the environments documentation on how to do that).

That gets you a proper environment to develop in. From there you can open a terminal with Python: Create Terminal and that will automatically activate the virtual environment, putting python on your path so you can use python -m pip install to install your dependencies (pip will also be there, but it's better to use python -m pip to help make sure you're installing into the Python interpreter you expect).

Upvotes: 1

Related Questions