Ros installed,when import cv2 in anaconda2 py3 appear error like this:
Ros installed,when import cv2 in anaconda2 py3 appear error like this:

Obviously,error appeared in /opt/ros bagfile, there are prety solutions in google,but this order is best:
The problem here is that Python is looking for a package in /opt/ros/kinetic/lib/python2.7/dist-packages/ when it should be looking in the Anaconda installation directories. The reason for this is that with your ROS install, your .bashrc file contains the line source /opt/ros/kinetic/setup.bash, which sets your PYTHONPATH variable to the /opt/ros/kinetic/... location.
The solution is to unset your PYTHONPATH variable before sourcing your Anaconda environment:
$ unset PYTHONPATH
$ source activate RoboND
And it should work! But in this case, you'll need to remember to do this each time you want to use your Anaconda Python install.
When you activate your Anaconda python environment everytime,you should input this order:unset PYTHONPATH.
本文详细介绍了当在Anaconda环境下使用ROS时,遇到Python路径冲突导致无法导入cv2模块的问题及其解决方案。通过调整环境变量PYTHONPATH,可以确保Python正确指向Anaconda安装目录,从而避免错误。
7995

被折叠的 条评论
为什么被折叠?



