摘要 |
Provided are a method and device for the cross-platform transplantation of a python program. The method comprises: compiling a python program of a local machine using an original python compilation tool to obtain a pgen program of a local machine version; modifying configuration information about the original python compilation tool to enable same to replace a compiler of a target machine on a platform different from the local machine, wherein the pgen program generated by the modified python compilation tool belongs to a target machine version, and cannot be executed on the local machine; compiling a python program of a target machine on the local machine using the modified python compilation tool, and in the process of compilation, replacing a pgen program of the target machine with the pgen program of the local machine version to execute on the local machine, thereby obtaining a compilation file of the python program of the target machine; and importing the compilation file of the python program of the target machine into the target machine or providing the compilation file for the target machine through a remote service. The solution in the embodiments of the present invention realizes the cross-platform transplantation of a python program, thereby contributing to the efficiency of developing software products on different platforms. |