╰─➤  python -m movie.kuaishou_ks_web           
Traceback (most recent call last):
  File "/home/pon/opt/python/cpython/python3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/pon/opt/python/cpython/python3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/pon/code/work/pon-it/search_engine_crawler/movie/kuaishou_ks_web.py", line 7, in <module>
    import cv2
  File "/home/pon/.local/share/virtualenvs/search_engine_crawler-hrdNTCoq/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/home/pon/.local/share/virtualenvs/search_engine_crawler-hrdNTCoq/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/home/pon/opt/python/cpython/python3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

安装 libgl1-mesa-glx 报错

─➤  sudo apt-get install libgl1-mesa-glx                                                                                                                                                                                                                                                                   1 ↵
[sudo] password for pon: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libgl1-mesa-glx is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libgl1-mesa-glx' has no installation candidate

查了一下 https://askubuntu.com/questions/1517352/issues-installing-lib...

发现是包的名称变了,变成 libgl1libglx-mesa0

完整命令: sudo apt-get install libgl1 libglx-mesa0

─➤  sudo apt-get install libgl1 libglx-mesa0                                                                                                                                                                                                                                                             100 ↵
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libgl1-amber-dri libgl1-mesa-dri libglapi-mesa libglvnd0 libglx0 libllvm17t64 libpciaccess0 libvulkan1 libwayland-client0 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-sync1 libxcb-xfixes0 libxfixes3
  libxshmfence1 libxxf86vm1 mesa-vulkan-drivers
The following NEW packages will be installed:
  libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libgl1 libgl1-amber-dri libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libllvm17t64 libpciaccess0 libvulkan1 libwayland-client0 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-sync1 libxcb-xfixes0
  libxfixes3 libxshmfence1 libxxf86vm1 mesa-vulkan-drivers
0 upgraded, 26 newly installed, 0 to remove and 1 not upgraded.
Need to get 51.2 MB of archives.
After this operation, 231 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

如果是旧系统,请参考:https://segmentfault.com/a/1190000041459362


universe_king
3.4k 声望680 粉丝