Fix numpy bug on Ubuntu16 and Ubuntu18 which will cause segmentfault

test=develop
ce_debug
minqiyang 7 years ago
parent f6a877bc57
commit 42d1b3f786

@ -32,11 +32,27 @@ the image layout as follows.
from __future__ import print_function from __future__ import print_function
import six
import numpy as np import numpy as np
try: # NOTE(minqiyang): this is an ugly fix for the numpy bug reported here
import cv2 # https://github.com/numpy/numpy/issues/12497
except ImportError: if six.PY3:
cv2 = None import subprocess
import sys
import_cv2_proc = subprocess.Popen([sys.executable, "-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
else:
try:
import cv2
except ImportError:
cv2 = None
import os import os
import tarfile import tarfile
import six.moves.cPickle as pickle import six.moves.cPickle as pickle

Loading…
Cancel
Save