Ubuntu 20.04 LTSPython 3.8ROS Noetic Desktop Full installed
确认我确实有文件/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- nonote -cv-bridge已经是最新的版本了。
但是当我的代码到达
这一行时from cv_bridge.boost.cv_bridge_boost import getCvType
我
ImportError: /lib/libgdal.so.26: undefined symbol: sqlite3_column_table_name
和我不知道如何处理这个
注意:我遵循无法使用ROS Kinetic和Python3的cv_bridge的说明
我尝试替换"kinetic"与"noetic"并将版本号替换为我的版本号(1.15.0)。
按指示做catkin build cv_bridge
,但给了我一些奇怪的输出。
警告& lt; & lt;Cv_bridge:make/home/tdadmin/catkin_workspace/logs/Cv_bridge/build.make.000.log
cc1plus: warning:/home/tdadmin/.local/bin/python3.6m: not a directoryCc1plus:警告:/home/tadmin/.local/bin/python3.6m:不是一个目录Cc1plus:警告:/home/tadmin/.local/bin/python3.6m:不是一个目录Cc1plus:警告:/home/tadmin/.local/bin/python3.6m:不是一个目录cd/home/tdadmin/catkin_workspace/构建/cv_bridge;Catkin build——get-env cv_bridge | Catkin env -si/usr/bin/make——jobserver-auth=3,4;cd -
我不知道为什么要看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安装正确,你可以打开一个新的终端,只查找已安装的软件包: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