pythonvisual-studiopipptvs

Can pip be used with Python Tools in Visual Studio?


I'm collaborating with some fellow students to build a python app, and was hoping to use the 'training wheels' of Visual Studio intelli-sense. They use python on mac and linux, so ideally our source control repo would consist of just *.py source files that we wrote, and a requirements.txt export of pip dependancies (using the pip freeze method).

I would love to be able to create a new Visual Studio project, then be able to run the following commands (for instance) within that project:

pip install boto
pip install fabric
pip install cuisine
pip freeze > requirements.txt

And after that, be able to write some code that references these libraries and be able to run it from within Visual Studio.

Is there any way to do this? Is Python within Visual Studio even able to handle modules in the format they are available within pip, or do all python libraries used in VS have to have been pre-compiled for Windows?


Solution

  • Yep! Go to Tools -> Python Tools -> Python Environments.

    This will open a new pane where you can select pip (VS 2015) or Packages (VS 2017) from the menu (it will say Overview by default) and then you can enter your module and double click to install.

    enter image description here

    Some packages have complex dependencies, and you might need to install them manually from these links: