小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
在jupyter中运行ROS2节点程序时出错
-
请教下大家:
我在jupyter中运行ROS2中的 from rclpy.node import Node后一直提示有错误,请见图片所示。
不知道是那里的问题。
我的系统信息如下:
1、我是按照小鱼foxy版ROS2教程的第7.12章节操作的,只是在小鱼给出的miniconda下载地址中没有找到教程里面说的这里“小鱼推荐选择Python3.8 Miniconda3 Linux 64-bit” 这个版本,就下载了个相近的3.9
2、我的系统是ubuntu20.04.6 amd64bit
3、ROS2版本是foxy以下为文字版错误log信息:
*---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from rclpy.node import NodeFile /opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py:42
40 from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
41 from rclpy.callback_groups import ReentrantCallbackGroup
---> 42 from rclpy.client import Client
43 from rclpy.clock import Clock
44 from rclpy.clock import ROSClockFile /opt/ros/foxy/lib/python3.8/site-packages/rclpy/client.py:22
20 from rclpy.callback_groups import CallbackGroup
21 from rclpy.context import Context
---> 22 from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
23 from rclpy.qos import QoSProfile
24 from rclpy.task import FutureFile /opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/implementation_singleton.py:31
15 """
16 Provide singleton access to the rclpy C modules.
17
(...)
26 # ...
27 """
29 from rclpy.impl import _import
---> 31 rclpy_implementation = _import('._rclpy')
32 rclpy_action_implementation = _import('._rclpy_action')
33 rclpy_logging_implementation = _import('._rclpy_logging')File /opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/init.py:28, in _import(name)
23 try:
24 # Since Python 3.8, on Windows we should ensure DLL directories are
25 # explicitly added to the search path.
26 # See https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
27 with add_dll_directories_from_env('PATH'):
---> 28 return importlib.import_module(name, package='rclpy')
29 except ImportError as e:
30 if e.path is None:File ~/miniconda3/lib/python3.9/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)ModuleNotFoundError: No module named 'rclpy._rclpy'
The C extension '/opt/ros/foxy/lib/python3.8/site-packages/rclpy/_rclpy.cpython-39-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/Installation-Troubleshooting/#import-failing-without-library-present-on-the-system' for possible solutions* -
@刘豪 右上角搜这个 linux-gun.so 一大堆答案
你不给文字版的log,我就不能帮你直接搜了
-
@小鱼
不好意思,我现在送上文字版log,感谢感谢!
如下:
ModuleNotFoundError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from rclpy.node import NodeFile /opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py:42
40 from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
41 from rclpy.callback_groups import ReentrantCallbackGroup
---> 42 from rclpy.client import Client
43 from rclpy.clock import Clock
44 from rclpy.clock import ROSClockFile /opt/ros/foxy/lib/python3.8/site-packages/rclpy/client.py:22
20 from rclpy.callback_groups import CallbackGroup
21 from rclpy.context import Context
---> 22 from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
23 from rclpy.qos import QoSProfile
24 from rclpy.task import FutureFile /opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/implementation_singleton.py:31
15 """
16 Provide singleton access to the rclpy C modules.
17
(...)
26 # ...
27 """
29 from rclpy.impl import _import
---> 31 rclpy_implementation = _import('._rclpy')
32 rclpy_action_implementation = _import('._rclpy_action')
33 rclpy_logging_implementation = _import('._rclpy_logging')File /opt/ros/foxy/lib/python3.8/site-packages/rclpy/impl/init.py:28, in _import(name)
23 try:
24 # Since Python 3.8, on Windows we should ensure DLL directories are
25 # explicitly added to the search path.
26 # See https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
27 with add_dll_directories_from_env('PATH'):
---> 28 return importlib.import_module(name, package='rclpy')
29 except ImportError as e:
30 if e.path is None:File ~/miniconda3/lib/python3.9/importlib/init.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)ModuleNotFoundError: No module named 'rclpy._rclpy'
The C extension '/opt/ros/foxy/lib/python3.8/site-packages/rclpy/_rclpy.cpython-39-x86_64-linux-gnu.so' isn't present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/Installation-Troubleshooting/#import-failing-without-library-present-on-the-system' for possible solutions -
此回复已被删除!