解决ros环境运行Python文件出现ImportError: No module named yaml的问题

File “/home/nvidia/Documents/roshell/hello_rospy/src/beginner_tutorials/scripts/talker.py”, line 39, in
import rospy
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/init.py”, line 47, in
from std_msgs.msg import Header
File “/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/init.py”, line 1, in
from ._Bool import *
File “/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/_Bool.py”, line 6, in
import genpy
File “/opt/ros/noetic/lib/python3/dist-packages/genpy/init.py”, line 34, in
from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
File “/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py”, line 48, in
import yaml
ImportError: No module named yaml

1, sudo apt-get install python3-yaml
or
2, pip install pyyaml

你可能感兴趣的:(python,开发语言,机器人,运维,服务器,linux)