Monday, November 4, 2019

[Python] make python script executable

Once you wrote a python script run.py, you can run it in the terminal as below:

$ python run.py

However, you can add #!/usr/bin/env python at the top of your run.py, so that the run.py becomes executable, and can be called without the preceding language "python".

$./run.py

Please also see why using #!/usr/bin/env python but not #!/usr/bin/python at this post.

No comments:

Post a Comment