games101安装opencv
时间: 2023-11-09 12:00:06 浏览: 107
安装 OpenCV 可以参考以下步骤:
1. 安装依赖项:
```
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
```
2. 下载 OpenCV 源代码:
```
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 3.4.0
```
3. 创建并进入 build 文件夹:
```
mkdir build
cd build
```
4. 编译并安装:
```
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j8
sudo make install
```
5. 配置环境变量:
将以下两行代码添加到 ~/.bashrc 文件中:
```
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
```
6. 更新环境变量:
```
source ~/.bashrc
```
阅读全文