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

升级Python至3.12.3后安装socketio遇netifaces编译失败求助

Python 3.12.3安装socketio时netifaces编译链接错误的解决办法

问题现象

之前用Python 3.12.2安装socketio后项目运行正常,升级到Python 3.12.3后安装socketio时触发编译错误,具体报错如下:

Creating library build\temp.win-amd64-cpython-312\Release\netifaces.cp312-win_amd64.lib and object build\temp.win-amd64-cpython-312\Release\netifaces.cp312-win_amd64.exp
netifaces.obj : error LNK2001: unresolved external symbol PyUnicode_FromUnicode
build\lib.win-amd64-cpython-312\netifaces.cp312-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for netifaces
Failed to build netifaces
ERROR: Could not build wheels for netifaces, which is required to install pyproject.toml-based projects

本质是netifaces源码编译时找不到Python 3.12.3中被移除的PyUnicode_FromUnicode符号,导致wheel构建失败,进而卡住socketio的安装流程。

解决办法

  • 强制安装预编译二进制包:跳过源码编译环节,直接让pip拉取适配Python 3.12.3的预编译netifaces包,执行命令:

    pip install netifaces --only-binary :all:
    

    装完netifaces后再正常安装socketio即可。

  • 回退Python版本:暂时降级到Python 3.12.2,这个版本能正常编译netifaces,适配socketio的安装需求。

  • 更新netifaces到最新版:执行命令升级netifaces,新版本大概率修复了Python 3.12.3的兼容性问题:

    pip install --upgrade netifaces
    

内容的提问来源于stack exchange,提问作者Shahzaib Nasir

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 10:13:08