          if status == 0:
              version = output
          else:
-@@ -1071,6 +1088,8 @@
+@@ -1197,6 +1214,8 @@
              return version
          # Return the first version found in the include dirs.
          for include_dir in ext.include_dirs:

+            output = check_output('sh -c "latex -version"', shell=True,
                                   stderr=subprocess.STDOUT)
             line = output.splitlines()[0].decode()
             pattern = '(3\.1\d+)|(MiKTeX \d+.\d+)'
@@ -2064,7 +2083,7 @@
 
     def check(self):
         try:

             header_fname = os.path.join(include_dir, 'freetype.h')
             if os.path.exists(header_fname):
                 major, minor, patch = 0, 0, 0
@@ -1369,11 +1388,11 @@
         }
 
     def check(self):
