1. Source:
- During the development process, we often encounter the need to encrypt or speed up the running speed. At this time, we can convert the py file into a pyd file to speed up the running speed.
2. Steps
- Create the setup.py file and edit the following content
#!/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"]))
- Run the following command to generate a pyd file
python setup.py build_ext --inplace