Can distutils set module / package as script executable?

I am using distutils.core.setup for the first time. I got it to install my module in / usr / lib / python / site -packages.

If I run python from any directory and execute import my_module , all this works fine.

However, I need to run my module as a script. It is not intended as a library, but rather as an application. If I run python my_module from the terminal, it does not find the file.

I wanted to create a script executable that would run my module and put the sym / in / usr / bin link in it, but this seems like a hacky way to solve this problem. I believe that distutils has something to install your module as a script executable, except that I could not find it. Can someone please give me an example or doc file for this?

Edit: Also, if this is the wrong way to distribute a python application, what should I use instead?

+4
source share
1 answer

Use distutils.core.setup (scripts = ['myprogram']) instead of py_modules = ['mymodule.py']

+4
source

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


All Articles