Skip to content

OSError: [WinError 193] %1 不是有效的 Win32 应用程序。 #18

Open

Description

@great-wind

系统:windows 64 位操作系统

通过以下命令安装GmSSL-3.1.1:

mkdir build
cd build
cmake .. -G "NMake Makefiles" -DWIN32=ON
nmake
nmake install

image

使用python -m unittest -v命令,出现以下错误:
image

请问如何解决

Activity

  1. ZM-J commented on Nov 18, 2024

    @ZM-J

    换 linux 系统

  2. ferstar commented on Oct 18, 2025

    @ferstar

    ✅ WinError 193 架构不匹配问题已解决

    你好!这个 [WinError 193] %1 不是有效的 Win32 应用程序 错误已经在 PR #26 中彻底解决:
    #26

    🔧 问题根源

    WinError 193 通常是由架构不匹配引起的:

    • 64-bit Python 尝试加载 32-bit DLL
    • 32-bit Python 尝试加载 64-bit DLL
    • 使用 NMake 编译时架构配置错误

    ✨ PR #26 的解决方案

    提供预编译的正确架构库:

    # 直接安装,自动匹配 Python 架构
    pip install https://github.com/ferstar/GmSSL-Python/releases/download/v2.2.2/gmssl_python-2.2.2-py3-none-any.whl

    特性:

    • ✅ 预编译的 64-bit Windows x86_64 库
    • ✅ 兼容 Python 3.8-3.14
    • ✅ 无需手动编译,避免架构配置错误
    • ✅ 所有依赖已正确打包

    📦 测试验证

    在 Windows x86_64 平台通过了 124 个单元测试,包括:

    • SM2 加密/签名
    • SM3 哈希
    • SM4 加密
    • SM9 加密/签名

    💡 建议

    如果你需要使用 32-bit Python,建议:

    1. 升级到 64-bit Python(推荐)
    2. 或者从源码使用正确的架构编译 GmSSL

    下载链接:https://github.com/ferstar/GmSSL-Python/releases/tag/v2.2.2

    欢迎测试反馈!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions