由于盲目跟教程安装,遇到了很多坑,终于把所有坑的原理摸清了,现在整理总结一下。下面分别介绍具体的安装和遇到的问题。
确保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 "" , 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
import re
File "/usr/lib/python3.5/re.py", line 335, in
import copyreg
File "/opt/ros/kinetic/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in
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
import copyreg
File "/opt/ros/kinetic/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in
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
import re
File "/usr/lib/python3.5/re.py", line 335, in
import copyreg
File "/opt/ros/kinetic/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in
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
以上!!!愿你遇到的问题都能找到答案。