Python Tools For Visual Studio Installation

Introduction

 
The Python Tools for Visual Studio extension is completely free. Python Tools supports different kinds of Visual Studio editions like:
  • Visual Studio 2015 Community Edition
  • Visual Studio 2015 Express for Web
  • Visual Studio 2015 Express for Desktop
  • Visual Studio 2013 Community Edition
  • Visual Studio 2013 Express for Web
  • Visual Studio 2013 Express for Desktop
    Visual Studio
     
    Visual Studio
Features
  • Python language is a Free and open source.
  • Python language is Reliable
  • Python language is Flexible.
  • Python language has supporting imperatives.
  • Python language is object-oriented programming style.
  • Python language has profiling tools.
  • Python language has testing tools.
Install Process
 
Step 1 Python Tools
  • Download and install Visual Studio 2015 Community and select Custom installation
  • Web Installer https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409
  • ISO Image (Offline Installer) https://go.microsoft.com/fwlink/?LinkId=615448&clcid=0x409
  • If you have already installed Visual Studio 2015 Community, just repair Visual Studio 2015 Community
  • If you try to install Visual Studio Offline, just repair Visual Studio 2015 Community
  • Check if Python Tools is enabled or not; if the Python Tools are not enabled in Visual Studio 2015 Community, check Python Tools
     
    Visual Studio
Step 2 Install an interpreter
 
Visual Studio
 
Python has different kinds of interpreters. They are
  • CPython
  • IronPython
  • Anaconda
  • Canopy
     
  • CPython
    • CPython is a native Python interpreter.
    • CPython supports maximum library compatibility
    • CPython supports maximum language compatibility
       
      Visual Studio
       
    • Path for Install Python 2.7.10 32-bit https://www.python.org/ftp/python/2.7.10/python-2.7.10.msi
    • Path for Install Python 3.5.0 32-bit https://www.python.org/ftp/python/3.5.0/python-3.5.0-webinstall.exe

  • IronPython
    • Interfacing is good with C#.
       
      Visual Studio
       
    • The path for Install IronPython https://github.com/IronLanguages/main/releases/tag/ipy-2.7.6.3
       
  • Anaconda
    • The path for installing Anaconda  http://www.continuum.io/downloads
       
      Visual Studio
       
  • Canopy
    • The path for installing Canopy  https://www.enthought.com/downloads/
       
      Visual Studio
All installation processes are over and now we can develop Python applications in our visual studio
 
Step 3
 
Create a C# project and write the following code.
 
Create new project=>Click python application.
 
Visual Studio
 
Add the below code to your application.
  1. namespace WindowsFormsApplication1 {  
  2.     public partial class Form1: Form {  
  3.         public Form1() {  
  4.             InitializeComponent();  
  5.         }  
  6.   
  7.         private void button1_Click(object sender, EventArgs e) {  
  8.             run_cmd();  
  9.         }  
  10.   
  11.         private void run_cmd() {  
  12.   
  13.             string fileName = @ "C:\sample_script.py";  
  14.   
  15.             Process p = new Process();  
  16.             p.StartInfo = new ProcessStartInfo(@ "C:\Python27\python.exe", fileName) {  
  17.                 RedirectStandardOutput = true,  
  18.                     UseShellExecute = false,  
  19.                     CreateNoWindow = true  
  20.             };  
  21.             p.Start();  
  22.   
  23.             string output = p.StandardOutput.ReadToEnd();  
  24.             p.WaitForExit();  
  25.   
  26.             Console.WriteLine(output);  
  27.   
  28.             Console.ReadLine();  
  29.   
  30.         }  
  31.     }  
  32. }  
Python sample_script
  1. print "Python C# Test"  
Output
 
We will see the 'Python C# Test' in our console of C#.


Recommended Free Ebook
Similar Articles