安裝
根據實際安裝需要,選擇 “僅安裝python接口” 或 “同時安裝python/c++接口” 其中一種即可。
僅安裝python接口
僅支持TensorFlow、PyTorch,不支持Caffe。
pip install opencv-python
若pip不能正常使用,則去 清華大學鏡像站 中找到最新版的opencv包(.whl文件),下載之。
直接pip install下好的安裝包
pip install xxx.whl
同時安裝python/c++接口
源碼編譯,支持Caffe。
mkdir build
cd build/
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j32
sudo make install
判斷安裝成功
pkg-config --modversion opencv