未验证 提交 15b6e2a8 编写于 作者: Q Qiyang Min 提交者: GitHub

Merge pull request #14795 from velconia/local_rel_1_2

Fix numpy bug on Ubuntu16 and Ubuntu18 which will cause segmentfault 
...@@ -32,10 +32,27 @@ the image layout as follows. ...@@ -32,10 +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: # FIXME(minqiyang): this is an ugly fix for the numpy bug reported here
# https://github.com/numpy/numpy/issues/12497
if six.PY3:
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 import cv2
except ImportError: except ImportError:
cv2 = None cv2 = None
import os import os
import tarfile import tarfile
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册