--- setuptools-51.1.2/launcher.c.orig	2021-01-12 11:59:21.949463100 +0530
+++ setuptools-51.1.2/launcher.c	2021-01-12 12:02:58.977876400 +0530
@@ -117,14 +117,16 @@
     if (drive[0] || dir[0]=='\\') {
         return loadable_exe(exename);   /* absolute path, use directly */
     }
-    /* Use the script's parent directory, which should be the Python home
-       (This should only be used for bdist_wininst-installed scripts, because
+    /* Use the script's directory (parent directory if not mingw-w64), which should be the
+       Python home (This should only be used for bdist_wininst-installed scripts, because
         easy_install-ed scripts use the absolute path to python[w].exe
     */
     _splitpath(script, drive, dir, fname, ext);
     result = dir + strlen(dir) -1;
+#if !defined(__MINGW64_VERSION_MAJOR)
     if (*result == '\\') result--;
     while (*result != '\\' && result>=dir) *result-- = 0;
+#endif
     _makepath(path, drive, dir, exename, NULL);
     return loadable_exe(path);
 }
