使用镜像源安装opencv
时间: 2024-01-01 18:04:12 浏览: 147
使用镜像源安装OpenCV的步骤如下:
1. 打开终端或命令提示符,输入以下命令以更新软件包列表:
```shell
sudo apt-get update
```
2. 安装OpenCV的依赖项:
```shell
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
```
3. 安装图像和视频I/O库:
```shell
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libeigen3-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev sphinx-common libtbb-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libopenexr-dev libgstreamer-plugins-base1.0-dev libavutil-dev libavfilter-dev libavresample-dev
```
4. 下载OpenCV源代码:
```shell
git clone https://github.com/opencv/opencv.git
```
5. 进入OpenCV目录并创建一个名为build的新目录:
```shell
cd opencv
mkdir build
cd build
```
6. 使用cmake生成Makefile:
```shell
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
```
7. 编译OpenCV:
```shell
make -j4
```
8. 安装OpenCV:
```shell
sudo make install
```
9. 配置OpenCV库路径:
```shell
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
```
阅读全文