Prog1020
Prog1020

Reputation: 4781

PythonNN.zip: are PYC files needed

I make Python3+Delphi app. I packed all files+dirs from Libs folder into python32.zip. It works.

Upvotes: 0

Views: 427

Answers (1)

Iguananaut
Iguananaut

Reputation: 23346

You don't need to include the pyc files, no. Assuming, that is, you are adding your zip file to sys.path and importing from that (the question could use more details along those lines), the Python zipimporter will gladly compile the bytecode for you on the fly.

You should have a little faster startup time if you include the pyc files (or for a stand-alone application you might consider including .pyo files instead, which you can make in various ways, such as running python with the -O flag). That said this bytecode compilation is pretty fast, so depending on how many modules your application imports it might not make a noticeable difference. Try it for yourself and see.

Upvotes: 1

Related Questions