运行Yowsup项目遇ModuleNotFoundError,安装axolotl_curve25519失败求助
问题描述
运行GitHub上的Yowsup项目时,出现模块缺失错误:ModuleNotFoundError: No module named 'axolotl_curve25519'
执行pip install python-axolotl-curve25519尝试安装模块时,编译阶段失败,核心报错为:
curve/curve25519-donna.c(48): fatal error C1083: 无法打开包含文件: 'string.h': 系统找不到指定的文件
完整安装错误日志:
C:\Users\Administrateur\Desktop\ws\yowsup-master>pip install python-axolotl-curve25519 Collecting python-axolotl-curve25519 Using cached python-axolotl-curve25519-0.4.1.post2.tar.gz (79 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: python-axolotl-curve25519 Building wheel for python-axolotl-curve25519 (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [17 lines of output] c:\users\administrateur\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py:463: UserWarning: Normalizing '0.4.1-2' to '0.4.1.post2' warnings.warn(tmpl.format(**locals())) running bdist_wheel running build running build_ext building 'axolotl_curve25519' extension creating build creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\curve creating build\temp.win-amd64-3.9\Release\curve\ed25519 creating build\temp.win-amd64-3.9\Release\curve\ed25519\additions creating build\temp.win-amd64-3.9\Release\curve\ed25519\nacl_sha512 C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icurve/ed25519/nacl_includes -Icurve/ed25519/additions -Icurve/ed25519 -Ic:\users\administrateur\appdata\local\programs\python\python39\include -Ic:\users\administrateur\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include /Tccurve/curve25519-donna.c /Fobuild\temp.win-amd64-3.9\Release\curve/curve25519-donna.obj curve25519-donna.c curve/curve25519-donna.c(48): fatal error C1083: 无法打开包含文件: 'string.h': 系统找不到指定的文件 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for python-axolotl-curve25519 Running setup.py clean for python-axolotl-curve25519 Failed to build python-axolotl-curve25519 Installing collected packages: python-axolotl-curve25519 Running setup.py install for python-axolotl-curve25519 ... error error: subprocess-exited-with-error × Running setup.py install for python-axolotl-curve25519 did not run successfully. │ exit code: 1 ╰─> [17 lines of output] c:\users\administrateur\appdata\local\programs\python\python39\lib\site-packages\setuptools\dist.py:463: UserWarning: Normalizing '0.4.1-2' to '0.4.1.post2' warnings.warn(tmpl.format(**locals())) running install running build running build_ext building 'axolotl_curve25519' extension creating build creating build\temp.win-amd64-3.9 creating build\temp.win-amd64-3.9\Release creating build\temp.win-amd64-3.9\Release\curve creating build\temp.win-amd64-3.9\Release\curve\ed25519 creating build\temp.win-amd64-3.9\Release\curve\ed25519\additions creating build\temp.win-amd64-3.9\Release\curve\ed25519\nacl_sha512 C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icurve/ed25519/nacl_includes -Icurve/ed25519/additions -Icurve/ed25519 -Ic:\users\administrateur\appdata\local\programs\python\python39\include -Ic:\users\administrateur\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include /Tccurve/curve25519-donna.c /Fobuild\temp.win-amd64-3.9\Release\curve/curve25519-donna.obj curve25519-donna.c curve/curve25519-donna.c(48): fatal error C1083: 无法打开包含文件: 'string.h': 系统找不到指定的文件 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure × Encountered error while trying to install package. ╰─> python-axolotl-curve25519 note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
解决方案
1. 补全Visual Studio Build Tools组件
string.h是Windows SDK提供的标准C头文件,找不到说明你的VS Build Tools缺少必要组件:
- 打开Visual Studio Installer,找到已安装的"Visual Studio Build Tools 2019",点击"修改"
- 在"工作负载"选项卡,确保勾选**"C++生成工具"**
- 切换到"单个组件"选项卡,搜索并勾选对应你系统版本的**"Windows SDK"**(如Windows 10 SDK 19041及以上)
- 完成安装后重启命令提示符,再执行
pip install python-axolotl-curve25519
2. 使用预编译二进制轮子跳过编译
如果不想配置编译环境,可以直接安装预编译的轮子文件:
- 确认你的Python版本和系统架构(比如Python 3.9 64位)
- 下载对应版本的
.whl格式轮子文件 - 执行本地安装命令:
pip install 本地轮子文件路径\python_axolotl_curve25519-0.4.1.post2-cp39-cp39-win_amd64.whl
3. 降级Python版本(可选)
旧版python-axolotl-curve25519可能和Python 3.9兼容性不佳,可尝试降级到Python 3.8后再执行安装命令。
内容的提问来源于stack exchange,提问作者Salma Madini
相关产品推荐
相关产品推荐

