xmlsec文档建议pip install xmlsec应该开箱即用
从1.3.7开始,Windows可以使用预先构建的车轮,因此运行pip xmlsec就足够了。
但是,这引发了一个错误(见下文)。
我找到了这个问题,我认为答案表明我需要在安装前添加本地库。但是,由于我是Windows的新手,所以我不知道如何安装libxml2-dev、libxmlsec1-dev或libxmlsec1-openssl等软件包。pip install libxml2-dev不工作,而且我无法在Windows上安装brew。我已经搜索过了,谷歌也做过广泛的搜索,只是找不出答案。
我还试着分别安装libxml2,方法是从bin文件夹中提取一些文件并将其添加到PATH中,如下所述:https://pages.lip6.fr/Jean-Francois.Perrot/XML-Int/Session1/WinLibxml.html,但这也不起作用。
Building wheels for collected packages: xmlsec
Building wheel for xmlsec (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for xmlsec (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [62 lines of output]
running bdist_wheel
running build
running build_py
package init file 'src\xmlsec\__init__.py' not found (or not a regular file)
running build_ext
building 'xmlsec' extension
constants.c
...LOTS OF ERRORS/WARNINGS...
fatal error C1047: The object or library file 'C:\Users\12345\AppData\Local\Temp\pip-install-3tfgg6bc\xmlsec_12345\build\tmp\libs\iconv-1.14.win64\lib\iconv_a.lib' was created with an older compiler than other objects; rebuild old objects and libraries
LINK : fatal error LNK1257: code generation failed
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\link.exe' failed with exit code 1257
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec, which is required to install pyproject.toml-based projects`发布于 2022-02-03 09:55:53
xmlsec文档建议pip安装xmlsec应该立即工作。
他们指的是,他们为windows提供了.whl文件。你可以确认如果你检查pypi页面。但是,只支持python 3.5-3.9。如果您正在运行pyhton 3.10,则尝试从源代码编译。
看起来,xmlsec正在从https://github.com/bgaifullin/libxml2-win-binaries/releases/下载预构建库,因为编译器版本错配,无法链接到编译器动态创建的库(请参阅错误消息):
fatal error C1047: The object or library file 'C:\Users\12345\AppData\Local\Temp\pip-install-3tfgg6bc\xmlsec_12345\build\tmp\libs\iconv-1.14.win64\lib\iconv_a.lib' was created with an older compiler than other objects; rebuild old objects and libraries我认为解决这个问题的最简单的方法就是简单地将您的python降级到3.9,然后用pip安装。下载/编译您自己所需的lib版本并不能解决这个问题,因为xmlsec总是下载它认为需要的版本。
https://stackoverflow.com/questions/70960672
复制相似问题