RunFrozenPython#
Changed in version 0.15.2.
You can use a freezer like PyInstaller, cx_Freeze, py2exe etc. to freeze your Python module into an executable so that the recipient doesn’t have to install a full Python distribution.
Note
-
This does not work with UDFs.
-
Currently only available on Windows, but support for Mac should be easy to add.
-
You need at least 0.15.2 to support arguments whereas the syntax changed in 0.15.6
Use it as follows:
Sub MySample() RunFrozenPython "C:\path\to\dist\myproject\myproject.exe", "arg1 arg2" End Sub
(一)pycharm 打包py成可执行文件.exe ,使用pyinstaller
1、安装pyInstaller解释器
2、右键你自己的代码(我的叫:helloworld2.py),打开终端
3、在下方的terminal中执行命令:pyinstaller -F helloworld2.py,生成.exe文件
(二)在xlsm中修改VBA脚本 RunFrozenPython,注意 .exe文件的路径