0

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.

Dhruvik
  • 33
  • 1
  • 5
  • 2
    "but vs-code uses windows cmd/PowerShell therefore pip didn't work" that is not true – juanpa.arrivillaga Aug 02 '19 at 15:35
  • @juanpa.arrivillaga so how do I do? – Dhruvik Aug 02 '19 at 15:37
  • vs-code simply opens a terminal console for your convenience. What terminal is totally up to the operating system you are using. Aside from that, pip works also on cmd. Please refer to these step: https://docs.python.org/3/installing/index.html and if you get stuck try to update your question with more details relevant to the specific step in which errors occur. – aviya.developer Aug 02 '19 at 16:44
  • See [How to use pip with Visual Studio Code](https://stackoverflow.com/q/42463866/2745495) – Gino Mempin Aug 03 '19 at 00:59

1 Answers1

1

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).

Brett Cannon
  • 14,438
  • 3
  • 45
  • 40