pip install Cython
我們在需要打包的.py所在的文件夾新建py文件,在此處命名為build_pyd.py,其內容如下:
from distutils.core import setup from Cython.Build import cythonize setup( name='any words.....', ext_modules=cythonize(["需要引入的外部包.py", ]), )
執行以下cmd命令
python build_pyd.py build_ext --inplace
等pyd文件即編譯好,執行pyinstaller打包py文件
pyinstaller .\****.py