cmake -D BUILD_opencv_python3=yes -D BUILD_opencv_python2=no -D PYTHON3_EXECUTABLE=/home/wangyanyang/anaconda3/bin/python3.7m -D PYTHON3_INCLUDE_DIR=/home/wangyanyang/anaconda3/include/python3.7m -D PYTHON3_LIBRARY=/home/wangyanyang/anaconda3/lib/libpython3.7m.so -D PYTHON3_NUMPY_INCLUDE_DIRS=/home/wangyanyang/anaconda3/lib/python3.7/site-packages/numpy/core/include -D PYTHON3_PACKAGES_PATH=/home/wangyanyang/anaconda3/lib/python3.7/site-packages -D PYTHON_DEFAULT_EXECUTABLE=/home/wangyanyang/anaconda3/bin/python3.7m ..
###需要注意的是cmake的时候Python默认指定的环境变量版本不能是annaconda
make -j8
sudo make install