mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
This commit is contained in:
parent
89a9e92769
commit
a53ffec757
@ -1,5 +1,6 @@
|
|||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
@ -168,11 +169,27 @@ def ensure_base_env(work_dir, dep_dir):
|
|||||||
# opencv
|
# opencv
|
||||||
ocv = cmd_result('which opencv_version')
|
ocv = cmd_result('which opencv_version')
|
||||||
if ocv is None or len(ocv) < 1:
|
if ocv is None or len(ocv) < 1:
|
||||||
print('ocv not found, try install git ..', end='')
|
print('ocv not found, try install ocv ..', end='')
|
||||||
os.system(
|
|
||||||
'{} add-apt-repository ppa:ignaciovizzo/opencv3-nonfree -y'.format(
|
|
||||||
sudo))
|
|
||||||
os.system('{} apt update'.format(sudo))
|
os.system('{} apt update'.format(sudo))
|
||||||
|
|
||||||
|
pattern = re.compile(r'[0-9]+\.[0-9]+\.[0-9]+')
|
||||||
|
upstream = cmd_result('{} apt list libopencv-dev -a'.format(sudo))
|
||||||
|
|
||||||
|
add_ppa = True
|
||||||
|
if upstream is not None and len(upstream) > 0:
|
||||||
|
versions = pattern.findall(upstream)
|
||||||
|
if versions is not None and len(versions) > 0:
|
||||||
|
version = versions[0]
|
||||||
|
major = int(version.split('.')[0])
|
||||||
|
if major >= 3:
|
||||||
|
# Directly install upstream OCV, do not need add ppa
|
||||||
|
add_ppa = False
|
||||||
|
|
||||||
|
if add_ppa:
|
||||||
|
os.system(
|
||||||
|
'{} add-apt-repository ppa:ignaciovizzo/opencv3-nonfree -y'.
|
||||||
|
format(sudo))
|
||||||
|
|
||||||
os.system(
|
os.system(
|
||||||
'{} DEBIAN_FRONTEND="noninteractive" apt install libopencv-dev -y'
|
'{} DEBIAN_FRONTEND="noninteractive" apt install libopencv-dev -y'
|
||||||
.format(sudo))
|
.format(sudo))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user