anaconda python3环境中import cv2出错

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.

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值