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

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

上级 40cfe7b2
...@@ -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"
else:
interpreter = sys.executable interpreter = sys.executable
# Note(zhouwei): if use Python/C 'PyRun_SimpleString', '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.
先完成此消息的编辑!
想要评论请 注册