ubuntu 14.04 编译opencv + python
2017-03-23 本文已影响0人
jjkke88
编译opencv与python
- 从github上下载opencv对应版本代码, 假设位于/home/opencv
<pre>
cd /home/opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
make -j8
sudo make install
</pre> - 到这一步为止,opencv的python库被安装在/usr/lib/python2.7/dist-packgages
在virtualenv中使用cv2
- 将/usr/local/lib/python2.7/site-packages中的cv2.so和cv.py复制到对应的virtualenv的python目录的sites-packages中
<pre>
cp /usr/loal/lib/python2.7/site-packages/cv2.so ~/tensorflow0.12/lib/python2.7/site-packages
cp /usr/lib/python2.7/dist-packages/cv.py ~/tensorflow0.12/lib/python2.7/site-packages
</pre>