centos安装opencv
时间: 2023-10-02 12:13:22 浏览: 122
opencv安装
你可以按照以下步骤在CentOS上安装OpenCV:
1. 更新系统:
```
sudo yum update
```
2. 安装依赖项:
```
sudo yum install epel-release
sudo yum install cmake git gcc gcc-c++ pkgconfig
sudo yum install python3 python3-devel python3-pip
sudo yum install gtk2-devel numpy
```
3. 克隆OpenCV存储库:
```
git clone https://github.com/opencv/opencv.git
cd opencv
```
4. 创建并进入构建目录:
```
mkdir build
cd build
```
5. 配置CMake:
```
cmake ..
```
6. 编译和安装OpenCV:
```
make
sudo make install
```
7. 配置OpenCV库路径:
```
sudo echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf
sudo ldconfig
```
8. 验证安装:
```
python3 -c "import cv2; print(cv2.__version__)"
```
这些步骤将在CentOS上安装OpenCV,并通过验证确保安装成功。希望对你有所帮助!
阅读全文