ubuntu上evo的安装与问题解决

保姆级SLAM轨迹评价工具EVO的安装与问题解释

由于盲目跟教程安装,遇到了很多坑,终于把所有坑的原理摸清了,现在整理总结一下。下面分别介绍具体的安装和遇到的问题。

首次安装

确保ubantu在python2下!!!绝大多数都是2和3都有,下面的命令切换python。

sudo update-alternatives --config python

查看pip的版本,确保在pip2下操作。

pip --version 

我选择的是源码安装

git clone https://github.com/MichaelGrupp/evo
cd evo
pip install --editable . --upgrade --no-binary evo --user

安装成功后的测试

//随便画个图试试
cd test/data
evo_traj kitti KITTI_00_gt.txt -p 

再试下bag数据的处理。

evo_traj bag ROS_example.bag --all_topics -p

如果到这还没问题那恭喜啦。evo支持多种工具包,包括kitti,tum, bag ,EUROC。功能的介绍不是写这个的目的,下面说遇到的问题以及问题的原理,说的不对帮忙指正奥。

##由于开始安装的时候没有注意,在Python3的环境下安装导致处理bag包的时候无法使用,原因是tf2_py需要python2。
处理bag的时候报错如下:

Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
[ERROR] Unhandled error in evo.main_traj
Traceback (most recent call last):
  File "/home/sh/evo/evo/entry_points.py", line 98, in launch
    main_module.run(args)
  File "/home/sh/evo/evo/main_traj.py", line 297, in run
    trajectories, ref_traj = load_trajectories(args)
  File "/home/sh/evo/evo/main_traj.py", line 229, in load_trajectories
    bag, topic)
  File "/home/sh/evo/evo/tools/file_interface.py", line 249, in read_bag_trajectory
    from evo.tools import tf_cache
  File "/home/sh/evo/evo/tools/tf_cache.py", line 27, in <module>
    import tf2_py
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 38, in <module>
    from ._tf2 import *
ImportError: dynamic module does not define module export function (PyInit__tf2)

看最后一个File,去那个路径下安装lz4

//这里--target=是我的Python2.7的位置
sudo pip install --target=/opt/ros/kinetic/lib/python2.7/dist-packages lz4

然后依旧报错:

Error processing line 1 of /home/sh/.local/lib/python3.5/site-packages/matplotlib-3.0.3-py3.5-nspkg.pth:

Failed to import the site module
Traceback (most recent call last):
  File "/usr/lib/python3.5/site.py", line 173, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.5/types.py", line 166, in <module>
    import functools as _functools
  File "/usr/lib/python3.5/functools.py", line 21, in <module>
    from collections import namedtuple
  File "/usr/lib/python3.5/collections/__init__.py", line 32, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
  File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python3.5/site.py", line 290, in addusersitepackages
    addsitedir(user_site, known_paths)
  File "/usr/lib/python3.5/site.py", line 212, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/usr/lib/python3.5/site.py", line 183, in addpackage
    import traceback
  File "/usr/lib/python3.5/traceback.py", line 3, in <module>
    import collections
  File "/usr/lib/python3.5/collections/__init__.py", line 32, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

问题两个
1.matplotlib安装,
2.依旧找到的是Python 3.5。这里是安装的时候用3安装导致的,

pip install matplotlib -U
//看evo_traj位置
evo

报错:

Traceback (most recent call last):
  File "/home/sh/.local/bin/evo", line 5, in <module>
    import re
  File "/usr/lib/python3.5/re.py", line 335, in <module>
    import copyreg
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
    if not enabled():
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
    import re
  File "/usr/lib/python3.5/re.py", line 335, in <module>
    import copyreg
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

Original exception was:
Traceback (most recent call last):
  File "/home/sh/.local/bin/evo", line 5, in <module>
    import re
  File "/usr/lib/python3.5/re.py", line 335, in <module>
    import copyreg
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
sudo gedit /home/sh/.local/bin/evo

修改方法:

原文件#!/usr/bin/python3
改为#!/usr/bin/python2
或者如果你很确定自己的PYTHON环境变量链接到的就是2也可以改为:
#!/usr/bin/env python

以上!!!愿你遇到的问题都能找到答案。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值