生成 pyc、pyo
pip3 install
python -m compileall <dir>
python -o -m compileall <dir> ?
python -o -m compileall -l ./
命令能把当前目录下的所有 .py 编译成 .pyo 文件,不带 -l 参数可递归进子目录。
生成pyd文件
pip install Cython --install-option="--no-cython-compile"
from distutils.core import setup
from Cython.Build import cythonize
setup(name = 'Hello world',
ext_modules = cythonize("a.py"))
python setup.py build //生成.c文件
python setup.py install //生成pyd文件,根据运行过程提示,pyd被生成到了python根目录下Lib\site-packages中,可以直 接使用
pip install cython
pip install easycython