mjm@mjm-pc:~/Desktop/ros_robot_pro$ roslaunch ros_urdf_PK test.launch
Traceback (most recent call last):
File "/opt/ros/melodic/bin/roslaunch", line 34, in
import roslaunch
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 57, in
from .launch import ROSLaunchRunner
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/launch.py", line 55, in
from roslaunch.nodeprocess import create_master_process, create_node_process, DEFAULT_TIMEOUT_SIGINT, DEFAULT_TIMEOUT_SIGTERM
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/nodeprocess.py", line 53, in
from rosmaster.master_api import NUM_WORKERS
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmaster/__init__.py", line 35, in
from .main import rosmaster_main
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmaster/main.py", line 43, in
import rosmaster.master
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmaster/master.py", line 47, in
import rosmaster.master_api
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmaster/master_api.py", line 72, in
from rosmaster.util import xmlrpcapi
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosmaster/util.py", line 48, in
from defusedxml.xmlrpc import monkey_patch
ModuleNotFoundError: No module named 'defusedxml'
那说明Python 的替代版本尚未被 update-alternatives 命令识别.想解决这个问题,
我们需要更新一下替代列表,将python2.7和python3.4放入其中,使用如下命令将python2.7和python3.5加入到python列表中:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
下面我选择编号1,选择python2.7 验证在终端输入python即可: