Quick gist to accompany post on building ROS Melodic w/python3 support
- https://www.miguelalonsojr.com/blog/robotics/ros/python3/2019/08/20/ros-melodic-python-3-build.html
- Warning: don't try to run this as a script. It probably won't work.
sudo apt-get remove python-*
sudo apt-get remove ros-* sudo apt-get remove ros-melodic-* sudo apt-get autoremove
sudo apt update sudo apt install -y python3 python3-dev python3-pip build-essential sudo -H pip3 install rosdep rospkg rosinstall_generator rosinstall wstool vcstools catkin_tools catkin_pkg
sudo rosdep init rosdep update cd ~ mkdir ros_catkin_ws cd ros_catkin_ws
catkin config --init -DCMAKE_BUILD_TYPE=Release --blacklist rqt_rviz rviz_plugin_tutorials librviz_tutorial --install
rosinstall_generator desktop_full --rosdistro melodic --deps --tar > melodic-desktop-full.rosinstall wstool init -j8 src melodic-desktop-full.rosinstall
wstool update -j4 -t src
export ROS_PYTHON_VERSION=3 pip3 install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
#!/bin/bash #Check whether root if [ $(whoami) != root ]; then echo You must be root or use sudo to install packages. return fi
#Call apt-get for each package for pkg in "$@" do echo "Installing $pkg" sudo apt-get -my install $pkg >> install.log done
chmod +x install_skip
sudo ./install_skip rosdep check --from-paths src --ignore-src | grep python | sed -e "s/^apt\t//g" | sed -z "s/\n/ /g" | sed -e "s/python/python3/g"
rosdep install --from-paths src --ignore-src -y --skip-keys="rosdep check --from-paths src --ignore-src | grep python | sed -e "s/^apt\t//g" | sed -z "s/\n/ /g"
"
find . -type f -exec sed -i 's//usr/bin/env[ ]*python//usr/bin/env python3/g' {} +
catkin build