Do I need Python installed if I have PYC files?
I want to add Python as a scripting language to my game. If instead of distributing PY script, I distribute the PYC compiled fi开发者_如何学JAVAles with my game, will the user still need Python installed, or will the DLL be sufficient?
Not only would they still need the Python interpreter, but the compiled python byte-code files are not guaranteed to work across different platforms.
You do need an executable to actually load the files into the VM. Fortunately it doesn't need to be very complex.
pyinstaller can be used to convert the .py file into an executable file
to install the pyinstaller
pip install pyinstaller
and to convert the .py file let's say file.py
pyinstaller file.py
this will make two new folders in the same directory build and dist. dist folder contains all the required dll and file.exe to run the python code without python installed.
精彩评论