Ask Your Question

Revision history [back]

Not sure about the previous versions of ROS, but it easy to build ROS packages with python3 in ROS Melodic.

Modify the following file:

/opt/ros/melodic/etc/catkin/profile.d/1.ros_python_version.sh

from

export ROS_PYTHON_VERSION=2

to

export ROS_PYTHON_VERSION=3

Source the above-mentioned file.

source /opt/ros/melodic/etc/catkin/profile.d/1.ros_python_version.sh

Create a new workspace and build.

If you have an existing workspace, delete the devel/, build/ and .catkin_workspace file from your workspace and build again.