小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
动手学ROS2-入门篇-2-基础篇-5-python依赖查找流程
-
https://fishros.com/d2lros2/#/humble/chapt2/basic/5.Python依赖查找流程?id=_1编写ros2的python节点 里面的问题:
我在第二部运行python节点的时候
python3 second_ros2_node.py
就遇到了问题:Traceback (most recent call last): File "/home/wjh/d2lros2/chapt2/basic/second_ros2_node.py", line 3, in <module> import rclpy File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/init.py", line 49, in <module> from rclpy.signals import install_signal_handlers File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/signals.py", line 15, in <module> from rclpy.exceptions import InvalidHandle File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/exceptions.py", line 15, in <module> from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/impl/implementation_singleton.py", line 32, in <module> rclpy_implementation = import_c_library('._rclpy_pybind11', package) File "/opt/ros/humble/lib/python3.10/site-packages/rpyutils/import_c_library.py", line 39, in import_c_library return importlib.import_module(name, package=package) File "/home/wjh/anaconda3/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named 'rclpy._rclpy_pybind11' The C extension '/opt/ros/humble/lib/python3.10/site-packages/_rclpy_pybind11.cpython-39-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://docs.ros.org/en/humble/Guides/Installation-Troubleshooting.html#import-failing-without-library-present-on-the-system' for possible solutions
感觉是后面讲的:ModuleNotFoundError: No module named 'xxx',但是echo一下并且更改为正确的环境路径:
export PYTHONPATH=/opt/ros/humble/lib/python3.10/dist-packages
echo $PYTHONPATH #重新echo查看
python3 second_ros2_node.py反而找不到了:ModuleNotFoundError: No module named 'rclpy'
求大佬解答
-
pip install lark或者pip3 install lark
如果电脑显示有安装还报的话,看一下你电脑有没有装conda,进入base环境再下载编译。