Make Python script globally executable

Let's say I have this one-liner Python module called say_hello.py.

print 'Hello World'

How can I make a script executable from anywhere in my terminal? That is, it Hello Worldprints outside the Python interpreter anywhere in my system. I work on OS X Mavericks.

+4
source share
1 answer

General * nix answer

The first line of the script should look something like this:

#!/usr/bin/python

although the exact path may vary on your system. Then create a script executable and put it somewhere in your PATH.

+5
source

Source: https://habr.com/ru/post/1545137/


All Articles