ROS2 Conda 环境下报 No module named ‘catkin_pkg‘

环境

  • Ubuntu 22.04
  • ROS2
  • Conda Python 3.10 

解决方法

~/.bashrc 里注释掉 conda,并添加 export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages

sudo gedit ~/.bashrc

刷新使配置生效:

source ~/.bashrc


 

(carla) dwh@PC:~/carla-ros-bridge/catkin_ws$ python3 -c "import em; print(em.__version__)" 4.2 (carla) dwh@PC:~/carla-ros-bridge/catkin_ws$ cd ~/carla-ros-bridge/catkin_ws (carla) dwh@PC:~/carla-ros-bridge/catkin_ws$ catkin_make clean # 清理之前的编 译残留 Base path: /home/dwh/carla-ros-bridge/catkin_ws Source space: /home/dwh/carla-ros-bridge/catkin_ws/src Build space: /home/dwh/carla-ros-bridge/catkin_ws/build Devel space: /home/dwh/carla-ros-bridge/catkin_ws/devel Install space: /home/dwh/carla-ros-bridge/catkin_ws/install #### #### Running command: "cmake /home/dwh/carla-ros-bridge/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/dwh/carla-ros-bridge/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/dwh/carla-ros-bridge/catkin_ws/install -G Unix Makefiles" in "/home/dwh/carla-ros-bridge/catkin_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/dwh/carla-ros-bridge/catkin_ws/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/noetic -- This workspace overlays: /opt/ros/noetic -- Using PYTHON_EXECUTABLE: /home/dwh/ProgramFiles/anaconda3/envs/carla/bin/python3 -- Using Debian Python package layout -- Found PY_em: /home/dwh/ProgramFiles/anaconda3/envs/carla/lib/python3.7/site-packages/em.py -- Using empy: /home/dwh/ProgramFiles/anaconda3/envs/carla/lib/python3.7/site-packages/em.py -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/dwh/carla-ros-bridge/catkin_ws/build/test_results -- Forcing gtest/gmock from source, though one was otherwise available. -- Found gtest sources under '/usr/src/googletest': gtests will be built -- Found gmock sources under '/usr/src/googletest': gmock will be built -- Found PythonInterp: /home/dwh/ProgramFiles/anaconda3/envs/carla/bin/python3 (found version "3.7.12") -- Found Threads: TRUE -- Using Python nosetests: /usr/bin/nosetests3 ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg' Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH. CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message): execute_process(/home/dwh/ProgramFiles/anaconda3/envs/carla/bin/python3 "/opt/ros/noetic/share/catkin/cmake/parse_package_xml.py" "/opt/ros/noetic/share/catkin/cmake/../package.xml" "/home/dwh/carla-ros-bridge/catkin_ws/build/catkin/catkin_generated/version/package.cmake") returned error code 1 Call Stack (most recent call first): /opt/ros/noetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process) /opt/ros/noetic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml) /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include) CMakeLists.txt:58 (find_package) -- Configuring incomplete, errors occurred! See also "/home/dwh/carla-ros-bridge/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/dwh/carla-ros-bridge/catkin_ws/build/CMakeFiles/CMakeError.log". Invoking "cmake" failed
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值