pythonプログラムで「ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory」が発生した場合の対処方法を紹介します。
エラー例
Traceback (most recent call last):
File "scripts/txt2img.py", line 2, in <module>
import cv2
File "/root/anaconda3/envs/ldm/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/root/anaconda3/envs/ldm/lib/python3.8/site-packages/cv2/__init__.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
File "/root/anaconda3/envs/ldm/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
下記のコマンドで解決します。
apt-get install -y libglib2.0-0