简体   繁体   中英

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 files with my game, will the user still need Python installed, or will the DLL be sufficient?

他们不仅需要Python解释器,而且编译的python字节码文件不能保证在不同的平台上工作。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM