C++ Python embedding: Run on machine with no Python?
I'm trying to make a small game that supports Python scripting. I've no problems with using the Python C-API, but I don't know how to ensure that the game will r开发者_如何学Pythonun on a computer with no Python installed.
I know I need pythonXY.dll -- what else is there? When I try to run the program it tells me it cannot find encodings.utf_8. I tried copying the encodings/utf_8.py file in the same directory as my program, but the error still pops up.
You need the encodings/__init__.py
file, otherwise encodings is a folder and not a python package.
Chances are that you'll need a lot of stuff from within the python standard library. To make everything just work you'll need to include the entire standard library along with your program.
You can make this a bit better by putting the library in a zip file and adding that to sys.path. Also, you can include only pyc not the original py files.
精彩评论