- 代码修改:在 conda 环境下
\envs\paddle_class\Lib\sitepackages\paddle\dataset\image.py
作一下修该:
if six.PY3:
import subprocess
import sys
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,
# stderr=subprocess.PIPE)
# out, err = import_cv2_proc.communicate()
# retcode = import_cv2_proc.poll()
# if retcode != 0:
# cv2 = None
# else:
# import cv2
try:
import cv2
except ImportError:
cv2 = None
else:
try:
import cv2
except ImportError