Free since 2005 · No login required
AT

Academic Tutorials

Learn at your own pace

site-mobile-top-banner · 320x50

How do I make a Python script executable on Unix?

You need to do two things: the script file's mode must be executable and the first line must begin with #! followed by the path of the Python interpreter. The first is done by executing chmod +x scriptfile or perhaps chmod 755 scriptfile. The second can be done in a number of ways. The most straightforward way is to write #!/usr/local/bin/python