rosrun still use python2.7 instead of 3.8 inside noetic
I want to use rosrun or roslaunch to run some python node in ros noetic. Although the examples I tested worked in kinetic under ubuntu 16.04, they no longer work in noetic under ubuntu 20.04. The main problem that rosrun failed to locate yaml module, while calling the python script directly work. After some checking, and trying small examples, I found the problem by putting
import sys
print(sys.version)
import yaml
by running the script with rosrun I got:
nnn@aaa:~/ros/catkin_ws/src/node_example-main/src$ rosrun node_example pytalker.py
2.7.18rc1 (default, Apr 7 2020, 12:05:55)
[GCC 9.3.0]
by running it with default system python:
nnn@aaa:~/ros/catkin_ws/src/node_example-main/src$ python3 pytalker.py
3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0]
I tried many solution but all of them have failed.
for reference I used this example from ROS: https://github.com/tdenewiler/node_ex...
and "catkin_make install" build successfully with out errors or warnings.