Windows 里面的 .pyd 是类似 .so .dll 动态链接库的一种 Python 文件
) 软件和环境
- Win10 x64
- Python 3.8.10 x86
- Cython
- py2sec.py
- VS_2019_Community
) 安装 Python 3.8.10 x86
注意:我现在只用到的是 32位 , 所以下载32位 的版本, 当然 最后编译出来的 .pyd 也是32位的
) 安装 Cython
pip install cython
) 下载 py2sec
python py2sec.py -f test.py -r
# 生成 test.pyd 之后 模块名为 test 不能改名, 调用时,有错误弹出, 编译之前改好 test.py 的名称
) 安装 VS_2019_Community
不安装VS可以开始编译, 但会出现 “Unable to find vcvarsall.bat”
去下载 Visual Studio 2019 Community
* 如果页面发生改变, 请找到 VS 2019 Community 下载