Quantcast
Channel: Should I put #! (shebang) in Python scripts, and what form should it take? - Stack Overflow
Viewing all articles
Browse latest Browse all 17

Answer by MukeshKumar for Should I put #! (shebang) in Python scripts, and what form should it take?

$
0
0

If you want to make your file executable you must add shebang line to your scripts.

#!/usr/bin/env python3 

is better option in the sense that this will not be dependent on specific distro of linux but could be used on almost all linux distro since it hunts for the python3 path from environment variables, which is different for different distros of linux.

whereas

#!/usr/local/bin/python3 

would be a distro specific path for python3 and would not work if python3 is not found on this path, and could result in confusion and ambiguity for developer when migrating from one distro to another of linux.


Viewing all articles
Browse latest Browse all 17

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>