I don't know why ROS even screwed up my system paths like this, but this needs to change back
ROS did not "screwed up" your PYTHONPATH
.
Python modules distributed as ROS packages are not installed in system locations, exactly to avoid "screw[ing] up" your Python setup. They are installed in /opt/ros
/.
In order for Python to still be able to find those modules, the interpreter must somehow be made aware of them. So whenever you source /opt/ros/$ROS_DISTRO/setup.bash
or your Catkin workspace's setup.bash
(typically in the devel
space), the PYTHONPATH
variable gets updated to include the locations where ROS Python modules reside.
Without that change, nothing would work.
this needs to change back to what it was since I don't use Python 2.7, not sure why ROS does either.
The only Python version currently supported by ROS is 2.7, so it's expected to see python2.7
paths in PYTHONPATH
. Please refer to REP-3: Target Platform: Melodic Morenia for the version of Python that is specced for Melodic.
As to why this is the case: please refer to earlier Q&As about ROS and Python 3.
Does anyone know how I can get back my Python 3.6?
It (most likely) never went anywhere: just make sure to not automatically source /home/user/ros_ws/devel/setup.bash
if you do not need it and nothing should have changed.
If you want to make sure scripts and other programs use Python 3, spec python3
as the interpreter.