How do I compile multiple py files as one?

后端 未结 2 881
猫巷女王i
猫巷女王i 2021-01-18 03:00

I am new to Python and am totally lost as to where to even start to get this done.

I have written many small modules (a toolset for maya) that need to be compiled in

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 03:38

    The compileall module, present in the standard library, will compile all files in a directory, but it will still not generate a single .pyc file. An example of its usage is also given at effbot.org. I don't know if it's possible at all to create a single pyc file out of multiple modules.

    However, my guess is that you are looking into creating a python egg, which does make a single file out of a series of files grouped together in a package, which is what you want, I think.

提交回复
热议问题