安装opencv4.5 python import cv2 出现 ImportError: libopencv_ml.so.3.4: cannot open shared object file: No such file or directory
时间: 2023-10-14 14:31:42 浏览: 141
解决pip安装opencv遇到的from .cv2 import * ImportError: DLL load failed: 找不到指定的模块>>>问题(亲测)
您遇到的错误是因为在安装opencv4.5时找不到“libopencv_ml.so.3.4”这个共享对象文件。看起来您的系统缺少一些必要的依赖项。为了解决这个问题,您可以尝试以下方法:
1. 使用yum进行安装:
运行以下命令来安装所需的依赖项:
```
sudo yum install libglvnd-glx-1.0.1-0.8.git5baa1e5.el7.x86_64
```
2. 重新安装opencv包:
首先,使用pip卸载opencv-python:
```
pip uninstall opencv-python
```
然后,重新安装opencv-python-headless版本:
```
pip install opencv-python-headless
```
3. 解决另一个错误:
您提到遇到了另一个错误“ImportError: libGL.so.1: cannot open shared object file: No such file or directory”。这个错误可能是由于缺少libGL.so.1这个共享对象文件导致的。您可以尝试通过安装以下软件包来解决这个问题:
```
sudo yum install mesa-libGL
```
请按照上述步骤尝试解决您的问题,并确保您的系统中已经安装了必要的依赖项。这样应该能够解决“ImportError: libopencv_ml.so.3.4: cannot open shared object file: No such file or directory”的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [ubuntu import cv2 报错 ImportError: libopencv_ml.so.4.0](https://blog.csdn.net/qq_43134830/article/details/115730423)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [opencv ImportError: libGL.so.1: cannot open shared object file: No such file or directory](https://blog.csdn.net/guotianqing/article/details/115253263)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文