一,来源:
- 开发过程中经常遇到需要加密或加快运行速度的需求,此时可以将py文件转为pyd文件,可以加快运行速度
二,步骤
- 创建setup.py文件,编辑以下内容
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# here put the import lib
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize(["要转换的py文件名.py"]))
- 运行以下命令,即可生成pyd文件
python setup.py build_ext --inplace