from glob import glob
import os
import platform


def get_interpreters():
    if platform.system().lower() == 'linux':
        executables = [os.path.join('/usr/bin/', exe)
                       for exe in ['python2', 'python3']
                       if os.path.exists(os.path.join('/usr/bin/', exe))]
    else:
        executables = []
        paths = os.environ['PATH'].split(';')
        for path in paths:
            if 'python' in path.lower():
                executables.append(os.path.join(path, 'python.exe'))
    return executables

from glob import glob
import os
import platform


def get_interpreters():
    if platform.system().lower() == 'linux':
        executables = [os.path.join('/usr/bin/', exe)
                       for exe in ['python2', 'python3']
                       if os.path.exists(os.path.join('/usr/bin/', exe))]
    else:
        executables = []
        paths = os.environ['PATH'].split(';')
        for path in paths:
            if 'python' in path.lower():
                if 'scripts' in path.lower():
                     path = os.path.abspath(os.path.join(path, os.pardir))
                executables.append(os.path.join(path, 'python.exe'))
    return executables

Fix interpreter detection on windows
Fix interpreter detection on windows

  from glob import glob
  import os
  import platform
  
  
  def get_interpreters():
      if platform.system().lower() == 'linux':
          executables = [os.path.join('/usr/bin/', exe)
                         for exe in ['python2', 'python3']
                         if os.path.exists(os.path.join('/usr/bin/', exe))]
      else:
          executables = []
          paths = os.environ['PATH'].split(';')
          for path in paths:
              if 'python' in path.lower():
+                 if 'scripts' in path.lower():
+                      path = os.path.abspath(os.path.join(path, os.pardir))
                  executables.append(os.path.join(path, 'python.exe'))
      return executables
  
Fix interpreter detection on windows
## Code Before:
from glob import glob
import os
import platform


def get_interpreters():
    if platform.system().lower() == 'linux':
        executables = [os.path.join('/usr/bin/', exe)
                       for exe in ['python2', 'python3']
                       if os.path.exists(os.path.join('/usr/bin/', exe))]
    else:
        executables = []
        paths = os.environ['PATH'].split(';')
        for path in paths:
            if 'python' in path.lower():
                executables.append(os.path.join(path, 'python.exe'))
    return executables

## Instruction:
Fix interpreter detection on windows
## Code After:
from glob import glob
import os
import platform


def get_interpreters():
    if platform.system().lower() == 'linux':
        executables = [os.path.join('/usr/bin/', exe)
                       for exe in ['python2', 'python3']
                       if os.path.exists(os.path.join('/usr/bin/', exe))]
    else:
        executables = []
        paths = os.environ['PATH'].split(';')
        for path in paths:
            if 'python' in path.lower():
                if 'scripts' in path.lower():
                     path = os.path.abspath(os.path.join(path, os.pardir))
                executables.append(os.path.join(path, 'python.exe'))
    return executables
