I need to run a Python script on a machine that doesn't have Python installed. I use Python as a part of a software package, and Python runs behind the curtain without the user's notice of it.
What I did was as follows.
- Copy python.exe, python26.dll, msvcr90.dll and Microsoft.VC90.CRT.manifest
- Zip all the directory in LIBs directory as the python26.zip
- Copy all the necessary dll/pyd files inside the DLL directory.
It seems to work, but when I change the python26.zip to the other name such as pythonlib.zip, it cannot find the Python library any more.
- Question 1: What's the magic behind the python26.zip name? Python automatically finds a library inside a python26.zip, but not with different name?
- Question 2: If I have python26.zip at the same directory where python.exe/python26.dll is, I don't need to add path
sys.path.append
(THE PATH TO python26.zip). Is it correct?
Python has built-in libraries, and sys
is one of them. I thought that I could use sys.path
to point to whatever Python library in the ZIP file I needed. But, surprisingly, if I use the library name as Python26.zip, it just worked. Why is this so?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…