You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows平台下tgcrypto构建wheel失败问题求解

PS D:\> pip3 install -U --upgrade pyrogram tgcrypto
Requirement already satisfied: pyrogram in d:\nlr\nlr\lib\site-packages (2.0.106)
Collecting tgcrypto
  Using cached TgCrypto-1.2.5.tar.gz (37 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pyaes==1.6.1 in d:\nlr\nlr\lib\site-packages (from pyrogram) (1.6.1)
Requirement already satisfied: pysocks==1.7.1 in d:\nlr\nlr\lib\site-packages (from pyrogram) (1.7.1)
Building wheels for collected packages: tgcrypto
  Building wheel for tgcrypto (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for tgcrypto (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\tests
      copying tests\__init__.py -> build\lib.win-amd64-cpython-312\tests
      creating build\lib.win-amd64-cpython-312\tests\cbc
      copying tests\cbc\test_cbc.py -> build\lib.win-amd64-cpython-312\tests\cbc
      copying tests\cbc\__init__.py -> build\lib.win-amd64-cpython-312\tests\cbc
      creating build\lib.win-amd64-cpython-312\tests\ctr
      copying tests\ctr\test_ctr.py -> build\lib.win-amd64-cpython-312\tests\ctr
      copying tests\ctr\__init__.py -> build\lib.win-amd64-cpython-312\tests\ctr
      creating build\lib.win-amd64-cpython-312\tests\ige
      copying tests\ige\test_ige.py -> build\lib.win-amd64-cpython-312\tests\ige
      copying tests\ige\__init__.py -> build\lib.win-amd64-cpython-312\tests\ige
      running build_ext
      building 'tgcrypto' extension

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tgcrypto
Failed to build tgcrypto
ERROR: Could not build wheels for tgcrypto, which is required to install pyproject.toml-based projects
Windows下tgcrypto构建Wheel失败的解决办法

方案1:使用预编译二进制包安装

tgcrypto包含C扩展代码,Windows下编译需要额外环境,直接用预编译wheel包可跳过编译步骤:

  • 打开PowerShell执行:
pip install tgcrypto --only-binary :all:
  • 若仍失败,确认Python版本(如你使用的3.12),找到对应版本的tgcrypto wheel文件(格式示例:TgCrypto-1.2.5-cp312-cp312-win_amd64.whl),下载后本地安装:
pip install 本地wheel文件路径

方案2:安装C++编译环境

如需从源码编译,需配置Windows C++构建环境:

  1. 安装Visual Studio Build Tools,勾选「C++构建工具」 workload,确保包含:
    • MSVC v143生成工具(或对应版本)
    • 适配你系统的Windows SDK
    • C++ CMake工具
  2. 安装完成后打开新的PowerShell窗口,重新执行原命令:
pip3 install -U --upgrade pyrogram tgcrypto

方案3:降级Python版本

若当前Python版本过新(如3.12),tgcrypto可能未适配:

  1. 卸载当前Python,安装Python 3.11或3.10(推荐3.11)
  2. 重新配置pip环境后执行原安装命令即可

内容的提问来源于stack exchange,提问作者dinesh v

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 04:25:28