-1

I am trying to create a makefile that will create two script files (a client/server system) when 'make all' is run. I need to make it an executable script that has the python interpreter in the file so that they can just be run './server &' and then './client'.

I've tried pyinstaller but I don't just want an .exe file that runs the .py file, I need it to create a stand alone makefile like you can in c with:

gcc -o hellomake hellomake.c hellofunc.c -I

Basically I'm trying to find a way to do that line but with a .py file instead of .c

allisonk
  • 1
  • 1
  • 2
    C is a compiled language, so to run it you need to compile it. Python is an interpreted language, so you only need to point the interpreter to it. You just need to make the script executable `chmod u+x script.py` and put a [shebang](https://stackoverflow.com/questions/6908143/should-i-put-shebang-in-python-scripts-and-what-form-should-it-take) in the first line. – syntonym Feb 14 '19 at 23:04
  • Sounds like you want the script to set up an environment/container. Please look into `setup` for env manipulation and installation of scripts or `docker` for containerization. – Rocky Li Feb 14 '19 at 23:27
  • @syntonym I can get it to run a ./script.py with that, but can I then put that into a makefile that can run ./script by itself? Thanks! – allisonk Feb 14 '19 at 23:28
  • Did you already solve your problem? You can self answer so that others stumpling upon the same question can benefit. Otherwise I think you are using wrong terminology: A makefile (basically always with the filename `makefile`) is the file describing how to build stuff. Makefiles could e.g. also build pdfs. The word you are probably looking for is binary or executable. Pyinstaller should be able to bundle your scripts and the python interpreter in a single standalone executable. – syntonym Feb 25 '19 at 15:12

1 Answers1

0

There are pex files (https://pex.readthedocs.io/en/stable/) which wrap up all of your code and modules into a single binary. You still need the python interpreter on the system, but it does make deployment easier as it is now a single file.

dwagon
  • 501
  • 3
  • 9