未验证 提交 976f0146 编写于 作者: zhouweiwei2014's avatar zhouweiwei2014 提交者: GitHub

fix windows bug that python virtual env can't find python executable (#36227) (#36370)

ATT,cherry-pick #36227
上级 a5767bb6
...@@ -39,10 +39,12 @@ import numpy as np ...@@ -39,10 +39,12 @@ import numpy as np
if six.PY3: if six.PY3:
import subprocess import subprocess
import sys import sys
if sys.platform == 'win32': import os
interpreter = sys.exec_prefix + "\\" + "python.exe" interpreter = sys.executable
else: # Note(zhouwei): if use Python/C 'PyRun_SimpleString', 'sys.executable'
interpreter = sys.executable # will be the C++ execubable on Windows
if sys.platform == 'win32' and 'python.exe' not in interpreter:
interpreter = sys.exec_prefix + os.sep + 'python.exe'
import_cv2_proc = subprocess.Popen( import_cv2_proc = subprocess.Popen(
[interpreter, "-c", "import cv2"], [interpreter, "-c", "import cv2"],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册