3 ms·
Why not just add a shebang , chmod +x and then you're done?
by dagmx 5y ago
Why not just add a shebang , chmod +x and then you're done?
- yongjik 5y ago#!/usr/bin/python This is sometimes what you want, but it will always look at this exact path, and won't play nicely with virtualenv/conda. #!/usr/bin/env python This works - it will use Python found in $PATH. Unfortunately you can't add any more parameters to the interpreter. The contraption I wrote allows adding arbitrary parameters - I was burnt one too many times by Python silently buffering my debug messages, so I use it to always add "-u".
- emi2k01 5y agoReading `man env` in Linux shows that you can use: #!/usr/bin/env -S python $ARGS For example: #!/usr/bin/env -S python -i print("Entering interactive mode...") I'm not sure if it works in other OS.