解决roscore:Traceback (most recent call last): ... ImportError: No module named 'defusedxml'问题

Traceback (most recent call last):
  File "/opt/ros/kinetic/bin/roscore", line 36, in
    from rosmaster.master_api import NUM_WORKERS
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/__init__.py", line 35, in
    from .main import rosmaster_main
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/main.py", line 43, in
    import rosmaster.master
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/master.py", line 47, in
    import rosmaster.master_api
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/master_api.py", line 72, in
    from rosmaster.util import xmlrpcapi
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/util.py", line 48, in
    from defusedxml.xmlrpc import monkey_patch
ImportError: No module named 'defusedxml'

看了很多都没法解决我的问题,后来看到

https://blog.csdn.net/endurance2017/article/details/102997280的

,发现python软链接到了python3.6,根据该博文首先

sudo rm -rf /usr/bin/python

然后再重新建立到python2.7的软链接就行了:

sudo ln -s /usr/bin/python2.7 /usr/bin/python

你可能感兴趣的:(解决roscore:Traceback (most recent call last): ... ImportError: No module named 'defusedxml'问题)