Using Shebang in ROS2
Hi everyone! I used to be a ROS1 user, but recently I switched to ROS2 foxy. I couldn't use Shebang to change the python environment for running my node (Same as what I used to do in ROS1).
Here is the sample shebang code:
#!/home/user/dev_ws/src/test2/dtw/bin/python3
import cv2
def main():
print('Hi from test2.')
After running this, still it will be run by default ros python env.
FYI, I have created the package by Colcon.
Anyone know how I could address this issue?
I believe your objective is to run ROS 2 inside
virtualenv
. If yes, please see the following link: #q371083Thanks. I was trying to run different nodes with different virtual environment. The solution I found was using launch file with 'launch-prefix' argument.