:orphan:

=====================================
Python Tools for Visual Studio (PTVS)
=====================================

.. note::

    This page is no longer maintained, and may be out of date.

`Python Tools for Visual Studio <https://github.com/microsoft/PTVS/>`_ is a free, open source plugin
that turns Visual Studio into a Python IDE.

If you have installed Anaconda as your default Python installation and installed PTVS, your
Visual Studio installation is already set to use Anaconda's Python interpreter in PTVS.

To verify this, create a new Python project and then check whether Anaconda
is the Python that it uses.

.. note::

   These instructions refer to Anaconda Distribution exclusively, but will also work with Miniconda.


To create a new Python project:

#. In the **File** menu, select New, and then select Project. The keyboard shortcut is Ctrl-Shift-N.
   
#. Select Python Application:

   .. thumbnail:: /img/PTVS_newproj.png
      :align: center

To check which Python the project uses:

#. From the **Tools** menu, select Python Tools, and then select
   Python Interactive. The keyboard shortcut is Alt+I:

   .. thumbnail:: /img/PTVS_pythoninteractive1.png
      :align: center

#. In the **Python Interactive** window, type ``import sys`` and then press Enter.
#. Type ``sys.version`` and then press Enter.

If PTVS is using Anaconda, your Anaconda Python version is displayed. In the example below, it is Anaconda 1.5.0 (64-bit):

.. thumbnail:: /img/PTVS_pythoninteractive2.png
   :align: center

If PTVS does not automatically discover Anaconda, see the `official PTVS 
documentation <https://docs.microsoft.com/en-us/visualstudio/python/python-in-visual-studio>`_, especially the 
section on `Selecting and Installing Python Interpreters 
<https://docs.microsoft.com/en-us/visualstudio/python/python-environments#selecting-and-installing-python-interpreters>`_ 
and the `PTVS installation instructions 
<https://docs.microsoft.com/en-us/visualstudio/python/installation>`_.