1

I have a Python project with files in a directories structure and I would like to get all .pyc files to the same directories to deliver without sources.

I am trying to do this with python -m compileall -d /tmp/new -b . but all pyc files are created in their respective sources directories instead of /tmp/new/somedir/

Any ideas? Will i have to create a script to recreate this structure?

Benjamin
  • 3,350
  • 4
  • 24
  • 49

1 Answers1

0

Take a look about distributing *.pyc files:

What are the limitations of distributing .pyc files?

I suggest you use Py2Exe or cx_Freeze:

klassmann
  • 518
  • 10
  • 14
  • Thanks for this answer but I do not want an executable, I want to use this project as a library. – Benjamin Oct 30 '17 at 11:26
  • I have never used "pyc" files in this way, and I think that it's not a good idea, but if you want to try to do that, you should try to create a __pycache__ directory where you have the source files. Or you can check the documentation, I think that example can be useful: https://docs.python.org/3/library/compileall.html – klassmann Oct 30 '17 at 11:30