Ubuntu 20.04 LTS Python 3.8 ROS Noetic 桌面完整安装
确认我确实有该文件
/lib/libgdal.so.26
已执行
pip3 install opencv-python
已经执行过sudo apt install --reinstall gdal-bin libgdal-dev python3-gdal
已经执行过sudo apt-get install ros-noetic-cv-bridge
-- 上述结果是 ros-noetic-cv-bridge 已经是最新版本了。
但是当我的代码达到要求时
from cv_bridge.boost.cv_bridge_boost import getCvType
我明白了
ImportError: /lib/libgdal.so.26: undefined symbol: sqlite3_column_table_name
并且不知道如何处理这个问题
注意:我按照Unable to use cv_bridge with ROS Kinetic and Python3
中的说明进行操作我尝试将“kinetic”替换为“noetic”,并将版本号替换为我的(1.15.0)。
按照指示进行
catkin build cv_bridge
,但给了我一些奇怪的输出。
警告<< cv_bridge:make /home/tdadmin/catkin_workspace/logs/cv_bridge/build.make.000.log
cc1plus:警告:/home/tdadmin/.local/bin/python3.6m:不是目录
cc1plus:警告:/home/tdadmin/.local/bin/python3.6m:不是目录
cc1plus:警告:/home/tdadmin/.local/bin/python3.6m:不是目录
cc1plus:警告:/home/tdadmin/.local/bin/python3.6m:不是目录
cd /home/tdadmin/catkin_workspace/build/cv_bridge; catkin 构建 --get-env cv_bridge | catkin env -si /usr/bin/make --jobserver-auth=3,4;光盘-
我不确定为什么它会寻找 python3.6m 来解决任何问题。我按照 3.8 的规定设置了可执行行。
E:下面是~/catkin_workspace/src/vision_opencv/cv_bridge/CMakeLists.txt内容。
cmake_minimum_required(VERSION 3.0.2)
project(cv_bridge)
find_package(catkin REQUIRED COMPONENTS rosconsole sensor_msgs)
if(NOT ANDROID)
find_package(PythonLibs)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
# Debian Buster
find_package(Boost REQUIRED python37)
else()
# Ubuntu Focal
find_package(Boost REQUIRED python)
endif()
else()
find_package(Boost REQUIRED)
endif()
set(_opencv_version 4)
find_package(OpenCV 4 QUIET)
if(NOT OpenCV_FOUND)
message(STATUS "Did not find OpenCV 4, trying OpenCV 3")
set(_opencv_version 3)
endif()
find_package(OpenCV ${_opencv_version4} REQUIRED
COMPONENTS
opencv_core
opencv_imgproc
opencv_imgcodecs
CONFIG
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS rosconsole sensor_msgs
DEPENDS OpenCV
CFG_EXTRAS cv_bridge-extras.cmake
)
catkin_python_setup()
include_directories(include ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
if(NOT ANDROID)
add_subdirectory(python)
endif()
add_subdirectory(src)
if(CATKIN_ENABLE_TESTING)
add_subdirectory(test)
endif()
# install the include folder
install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
也就是说,这个目录中还有很多其他 CMakeLists.txt,包括
./src/vision_opencv/cv_bridge/python, ./src/vision_opencv/cv_bridge/test, ./src/vision_opencv/cv_bridge/, ./src/vision_opencv/cv_bridge/src
E2:这些是
catkin build cv_bridge
的结果
catkin build cv_bridge
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Profile: default
Extending: [cached] /opt/ros/noetic
Workspace: /home/tdadmin/catkin_workspace
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Build Space: [exists] /home/tdadmin/catkin_workspace/build
Devel Space: [exists] /home/tdadmin/catkin_workspace/devel
Install Space: [exists] /home/tdadmin/catkin_workspace/install
Log Space: [exists] /home/tdadmin/catkin_workspace/logs
Source Space: [exists] /home/tdadmin/catkin_workspace/src
DESTDIR: [unused] None
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Devel Space Layout: linked
Install Space Layout: merged
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Additional CMake Args: -DPYTHON_EXECUTABLE=/usr/bin/python3.8 -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so
Additional Make Args: None
Additional catkin Make Args: None
Internal Make Job Server: True
Cache Job Environments: False
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Whitelisted Packages: None
Blacklisted Packages: None
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Workspace configuration appears valid.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[build] Found '4' packages in 0.0 seconds.
Starting >>> cv_bridge
Finished <<< cv_bridge [ 0.9 seconds ]
[build] Summary: All 1 packages succeeded!
[build] Ignored: 3 packages were skipped or are blacklisted.
[build] Warnings: None.
[build] Abandoned: None.
[build] Failed: None.
[build] Runtime: 0.9 seconds total.
我认为这是混合路径和采购工作目录的问题。现在,您有两份
cv_bridge
副本,一份位于本地工作区,一份位于 /opt
中。如果一切都通过 apt 正确安装,您可以打开一个 new 终端并仅获取已安装的软件包: source /opt/ros/noetic/setup.bash
然后使用 python 命令行尝试 from cv_bridge.boost.cv_bridge_boost import getCvType
,它应该可以工作。如果没有,您应该通过 sudo apt remove ros-noetic-cv-bridge
卸载并重新安装。如果有效,您应该删除工作区中的本地副本。
使用普通的思维图像而不是使用完整的桌面。
FROM ros:noetic
RUN apt-get update \
&& apt-get install -q -y openssh-client \
&& apt-get install -q -y python3-pip \
&& apt-get install -q -y ros-noetic-cv-bridge \
&& apt-get install -q -y python3-opencv
这对我有用: 将其添加到
~/.bashrc
并在之后获取:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ros/noetic/lib