Skip to content

Commit 4bd503e

Browse files
committed
Check for official Python installation on Windows (resolve issue with static sys.prefix and custom python builds)
1 parent 887a24f commit 4bd503e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/misc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ export async function getPythonExecutable(useBuiltinPIOCore=true, customDirs = u
162162

163163
function isPython2(executable) {
164164
const pythonLines = [
165-
'import sys',
165+
'import os, sys',
166166
'assert sys.platform != "cygwin"',
167-
'assert not sys.platform.startswith("win") or not any(s in sys.executable.lower() for s in ("msys", "mingw"))',
167+
'assert not sys.platform.startswith("win") or not any(s in sys.executable.lower() for s in ("msys", "mingw", "emacs"))',
168+
'assert not sys.platform.startswith("win") or os.path.isdir(os.path.join(sys.prefix, "Scripts"))',
168169
'assert sys.version_info < (3, 0, 0)'
169170
];
170171
if (IS_WINDOWS) {

0 commit comments

Comments
 (0)