0

I was creating a Python program that I want to be able to call anywhere in my shell.

Suppose, for the sake of simplicity, that it is a hello.py program that output a "Hello World!" when called.

Sure, I can add #!/usr/bin/python to the first line, remove the .py extension and put it in some place in $PATH.

Then, I wished that other users could easily install it, so I was thinking about packaging this program and uploading it as a module to pip.

My question is: can I let people use it without having to type $ python -m hello, only calling $ hello instead? The only way I've been able to use python programs installed by pip until now is using $ python -m program_name.

Tried to search something about "global installation in pip" and "using pip packages without m flag" but didn't succeed.

diksown
  • 182
  • 1
  • 9
  • [macos - How do I make a python script executable? - Stack Overflow](https://stackoverflow.com/questions/27494758/how-do-i-make-a-python-script-executable/50468400#50468400) – user202729 Dec 06 '21 at 06:28
  • 1
    [What's the best way to distribute python command-line tools? - Stack Overflow](https://stackoverflow.com/questions/17893/whats-the-best-way-to-distribute-python-command-line-tools/17933#17933) – user202729 Dec 06 '21 at 06:30

0 Answers0