rosrun Error:
Traceback (most recent call last): File "/home/ving/catkin_ws/src/hello_tutorial/src/hello.py", line 3, in <module> import rospy File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 47, in <module> from std_msgs.msg import Header File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/__init__.py", line 1, in <module> from ._Bool import * File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/_Bool.py", line 6, in <module> import genpy File "/opt/ros/noetic/lib/python3/dist-packages/genpy/__init__.py", line 34, in <module> from . message import Message, SerializationError, DeserializationError, MessageException, struct_I File "/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py", line 48, in <module> import yaml ImportError: No module named yaml
Reason: there are two versions of python locally
Check the current version: /usr/bin/python –version
Solution:
sudo ln -sf /usr/bin/python3 /usr/local/bin/python
Similar Posts:
- Ubuntu18.04 (Python3.9) Error: ImportError: Cannot import name ‘sysconfig’ from ‘distutils’
- docker:ImportError: libcuda.so.1: cannot open shared object file: No such file or directory
- [Solved] peewee error: ImportError: No module named ‘MySQLdb’;pymysql error: from . import connections # noqa: E402
- ImportError: No module named pytz
- [Solved] SQLAlchemy Error: ImportError: cannot import name ‘TYPE_CHECKING’
- [Solved] “import numpy as np” ImportError: No module named numpy
- from bs4 import BeautifulSoup Error [How to Solve]
- Symbol not found: __PyCodecInfo_GetIncrementalDecoder
- How to Solve Centos Yum Error: No module named yum
- Under Ubuntu system, selenium opens the Firefox browser and prompts’ unable to find a matching set of capabilities. And message: connect