Answers for "ImportError: dynamic module does not define module export functio"

1

ImportError: dynamic module does not define module export function

# NOTES: ROS Melodic -- Python3.7
# Solution is to build cv_bridge with python3.
sudo apt-get install python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml ros-melodic-cv-bridge

# Create catkin workspace
mkdir catkin_workspace
cd catkin_workspace
catkin init

# Instruct catkin to set cmake variables
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so
# Instruct catkin to install built packages into install place. It is $CATKIN_WORKSPACE/install folder
catkin config --install

# Clone cv_bridge src
git clone https://github.com/ros-perception/vision_opencv.git src/vision_opencv
# Find version of cv_bridge in your repository
apt-cache show ros-melodic-cv-bridge | grep Version
    Version: 1.13-0******

# Checkout right version in git repo. In our case it is 1.13.0
cd src/vision_opencv/
git checkout 1.13.0
cd ../../
# Build
catkin build cv_bridge
# Extend environment with new package
source install/setup.bash --extend

# And you can test it with the following 
$ python3
Python 3.7.5 (default, Feb 23 2021, 13:22:40) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cv_bridge.boost.cv_bridge_boost import getCvType
>>> 

# Or add it to your bashrc file
source ~/catkin_workspace/install/setup.bash --extend
Posted by: Guest on August-30-2021

Code answers related to "ImportError: dynamic module does not define module export functio"

Python Answers by Framework

Browse Popular Code Answers by Language