Software Environment
- Ubuntu 18.04 system
- ROS melodic
View the CV2 location of the default installation of ROS
Change the name instead of cv2, just ok:
Check to remove
It can be found that there is also a cv2 so file, so we need to remove this as well.
Change the name, in case you need to use it in the future, it can be easily restored:
sudo mv /usr/lib/python2.7/dist-packages/cv2.x86_64-linux-gnu.so /usr/lib/python2.7/dist-packages/cv2.x86_64-linux-gnu.so.bak
It can be seen that there is no cv2 library now.
Install high version opencv-python
Installing opencv-python directly always reports an error inexplicably:
problem solved
The installed opencv-python version is too high, python2 does not support, just download the lower version:
pip install opencv-python==4.1.1.26
Successful installation!
Reference article: