Is there a way I can have multiple shebangs?
So I can call #!/usr/bin/env python3
on Ubuntu, but MacOS doesn't seem to have an equivalent, and I would like to call #!/usr/bin/python3
instead on it.
So is it possible to do something like:
#!/usr/bin/env python3
#!/usr/bin/python3
We can't have multiple shebang lines - there can only be one and it should always be the first line.
If you need to support multiple versions of Python based on OS, it is best to write a small shell wrapper that invokes your python script with the right interpreter, probably with an exec
.
macOS does have /usr/bin/env
.
See this post:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With