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?
Asked by arash.k7@gmail.com on 2022-09-25 21:04:31 UTC
Comments
I believe your objective is to run ROS 2 inside
virtualenv
. If yes, please see the following link: #q371083Asked by ravijoshi on 2022-10-03 02:37:35 UTC
Thanks. I was trying to run different nodes with different virtual environment. The solution I found was using launch file with 'launch-prefix' argument.
Asked by arash.k7@gmail.com on 2023-03-14 02:53:37 UTC