diff --git a/python/paddle/dataset/image.py b/python/paddle/dataset/image.py index 4fd7dc0d37ff8fcbb17f67066aa2184fcd5d4da9..c36213282c59cee8959e3a3502926f1d311291eb 100644 --- a/python/paddle/dataset/image.py +++ b/python/paddle/dataset/image.py @@ -39,10 +39,12 @@ import numpy as np if six.PY3: import subprocess import sys - if sys.platform == 'win32': - interpreter = sys.exec_prefix + "\\" + "python.exe" - else: - interpreter = sys.executable + import os + 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( [interpreter, "-c", "import cv2"], stdout=subprocess.PIPE,