美文网首页
CentOS7安装OpenCV(带Python开发环境)

CentOS7安装OpenCV(带Python开发环境)

作者: 蒜泥狠 | 来源:发表于2018-01-18 10:46 被阅读0次

    1: 获取opencv代码:

    cd /opt

    git clone https://github.com/Itseez/opencv.git

    cd opencv/

    git checkout tags/2.4.11

    2:编译代码:

    mkdir build

    cd build

    cmake -DCMAKE_BUILD_TYPE=RELEASE \

      -DCMAKE_INSTALL_PREFIX=/usr/local \

      -DINSTALL_PYTHON_EXAMPLES=ON \

      -DINSTALL_C_EXAMPLES=OFF \

      -DOPENCV_EXTRA_MODULES_PATH=~/opt/opencv/modules \

      -DPYTHON_EXECUTABLE=/usr/lib64/python2.7 \

      -DBUILD_EXAMPLES=ON ..

    make

    make install

    3:安装opencv的Python接口

    cd /usr/lib64/python2.7/site-packages/

    ln -s /usr/local/lib64/python2.7/site-packages/cv2.so cv2.so

    ln -s /usr/local/lib64/python2.7/site-packages/cv.py cv.py

    4:报错ImportError: No module named cv2

    相关文章

      网友评论

          本文标题:CentOS7安装OpenCV(带Python开发环境)

          本文链接:https://www.haomeiwen.com/subject/sgvioxtx.html