事前の 「$ sudo /usr/local/python3/bin/pip install opencv-python」だけでは、不足らしい。
$ ./foo_4_2.py Traceback (most recent call last): File "./foo_4_2.py", line 21, in <module> import cv2 File "/usr/local/python3/lib/python3.7/site-packages/cv2/__init__.py", line 3, in <module> from .cv2 import * ImportError: libSM.so.6: cannot open shared object file: No such file or directory
とエラーとなった為、以下のように「yum search libSM」で検索し、
$ yum search libSM CentOS-8 - AppStream 189 kB/s | 6.0 MB 00:32 CentOS-8 - Base 910 kB/s | 7.9 MB 00:08 CentOS-8 - Extras 587 B/s | 2.1 kB 00:03 ============================= Name Exactly Matched: libSM ============================= libSM.i686 : X.Org X11 SM runtime library libSM.x86_64 : X.Org X11 SM runtime library libSM.i686 : X.Org X11 SM runtime library libSM.x86_64 : X.Org X11 SM runtime library ============================ Name & Summary Matched: libSM ============================ libsmbios.i686 : Libsmbios C/C++ shared libraries libsmbios.x86_64 : Libsmbios C/C++ shared libraries ================================= Name Matched: libSM ================================= libsmi.i686 : A library to access SMI MIB information libsmi.x86_64 : A library to access SMI MIB information libSM-devel.i686 : X.Org X11 SM development package libSM-devel.x86_64 : X.Org X11 SM development package libsmartcols.x86_64 : Formatting library for ls-like programs. libsmbclient.x86_64 : The SMB client library libsmartcols.i686 : Formatting library for ls-like programs. libsmartcols.x86_64 : Formatting library for ls-like programs. libsmbclient.i686 : The SMB client library libsmbclient.x86_64 : The SMB client library libsmartcols-devel.i686 : Formatting library for ls-like programs. libsmartcols-devel.x86_64 : Formatting library for ls-like programs.
以下のようにinstallし、完了
$ sudo yum install libSM.x86_64