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. private void button1_Click(object sender, EventArgs e) {
  7. run_cmd();
  8. }
  9. private void run_cmd() {
  10. string fileName = @ "C:\sample_script.py";
  11. Process p = new Process();
  12. p.StartInfo = new ProcessStartInfo(@ "C:\Python27\python.exe", fileName) {
  13. RedirectStandardOutput = true,
  14. UseShellExecute = false,
  15. CreateNoWindow = true
  16. };
  17. p.Start();
  18. string output = p.StandardOutput.ReadToEnd();
  19. p.WaitForExit();
  20. Console.WriteLine(output);
  21. Console.ReadLine();
  22. }
  23. }
  24. }
Python sample_script
  1. print "Python C# Test"
Output
We will see the 'Python C# Test' in our console of C#.