Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

Thanks in advance for any help!

like image 349
Matt Avatar asked Mar 03 '13 12:03

Matt


People also ask

How do we install pip in Python in Visual Studio?

Select the Run command: pip install matplotlib option. This option installs matplotlib , and any packages it depends on (in this case, that includes numpy ). Consent to elevation if prompted to do so. After the package installs, it appears in the Python Environments window.

How do I add Python tools to Visual Studio?

Download and run the latest Visual Studio installer for Windows. Python support is present in the release 15.2 and later. If you have Visual Studio installed already, open Visual Studio and run the installer by selecting Tools > Get Tools and Features.

Can you use Python on visual studios?

Visual Studio is a powerful Python IDE on Windows. Visual Studio provides open-source support for the Python language through the Python Development and Data Science workloads (Visual Studio 2017 and later) and the free Python Tools for Visual Studio extension (Visual Studio 2015 and earlier).


2 Answers

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:

  • numpy http://sourceforge.net/projects/numpy/files/NumPy/
  • scipy http://sourceforge.net/projects/scipy/files/scipy/
  • Matplotlib http://matplotlib.org/downloads.html
  • Pandas http://pandas.pydata.org/getpandas.html
like image 132
Charles Clayton Avatar answered Sep 29 '22 12:09

Charles Clayton


On VS 2017, switch to the "solution explorer" and right click as indicated:

enter image description here

like image 25
Den-Jason Avatar answered Sep 29 '22 12:09

Den-Jason