Make python2.7 use the right version of opencv

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Make python2.7 use the right version of opencv相关的知识,希望对你有一定的参考价值。

Bug:

Some day I updated my openCV to the latest version 2.4.13, while recently I found I always get "2.4.8" when I check the version in python2.7. It is wired and anoiying. Also it is normal in C++.

This bug is quite similar with this one: opencv have different version with python module. Luckily the answer works. Also refer to PyImageSearch article - Install OpenCV 3.0 and Python 2.7+ on Ubuntu.

Fix:

It is related to the symbolically link problem. I was wasting time reinstalling openCV-2.4.13 for several times.

In all, after installing the new version of openCV, one more step is needed. We need to symbolically link our newly created library file -cv2.so- to our python package path.

Let‘s say

/usr/local/lib/python2.7/site-packages/cv2.so: symbolic link to `/usr/lib/python2.7/dist-packages/cv2.so‘

which is usually the case.

We need to remove that symbolic link with ‘rm‘ and create a new one with this command:

  ln -s ~path to your new cv2.so file ~/usr/local/lib/python2.7/site-packages/cv2.so

here it shall be

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

以上是关于Make python2.7 use the right version of opencv的主要内容,如果未能解决你的问题,请参考以下文章

pycharm安装第三方库:Try to run this command from the system terminal. Make sure that you use the,亲测已解

pycharm安装库的时候报错Try to run this command from the system terminal. Make sure that you use the correct

webpack vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin(示

pycharm安装第三方库:Try to run this command from the system terminal. Make sure that you use the问题,亲测已解决

vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your w

win7 64位下基于python2.7安装xgboost