4

I developed a simple Python app on Debian and I don't want to share my code. The user will be on Windows. I tried to use py_compile but the *.pyc file is not working on the other machine (Windows), giving a Bad magic number error. Probably the error is due to a different Python 3 version, but the code is full compatible with any Python 3 version.

So, the question is: how can I compile a script in *.pyc format that is not checking the Python version in a so strictly way?

Thanks

decadenza
  • 2,380
  • 3
  • 18
  • 31

2 Answers2

1

If you want to distribute your app easily without too much hazzle, just use one of the multiple available freezing tools, you'll get it running on multiple platforms easily without spending too much time.

BPL
  • 9,632
  • 9
  • 59
  • 117
0

Maybe you can try with https://docs.python.org/3/library/compileall.html. You can do something like this python -m compileall file.py

andrepogg
  • 152
  • 2
  • 16