在 windows 中安装 Python-saml 包时出错
Error while installing Python-saml package in windows
我想使用 python-saml 与 Flask Web 应用程序进行 SSO 集成。当我尝试使用 pip install python-saml
安装 python-saml 包时,我收到以下错误消息。
(myvenv) C:\Users\sekar>pip install python3-saml==1.9.0
Collecting python3-saml==1.9.0
Using cached python3_saml-1.9.0-py3-none-any.whl (72 kB)
Collecting xmlsec>=0.6.0
Using cached xmlsec-1.3.3.tar.gz (29 kB)
Building wheels for collected packages: xmlsec
Building wheel for xmlsec (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sekar\AppData\Local\conda\conda\envs\myvenv\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\sekar\AppData\Local\Temp\16\pip-install-9x0le85b\xmlsec\setup.py'"'"'; __file__='"'"'C:\Users\sekar\AppData\Local\Temp\16\pip-install-9x0le85b\xmlsec\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\sekar\AppData\Local\Temp\pip-wheel-39e4ydgb'
cwd: C:\Users\sekar\AppData\Local\Temp\pip-install-9x0le85b\xmlsec\
Complete output (5 lines):
running bdist_wheel
running build
running build_ext
error: HTTP Error 404: The specified blob does not exist.
Retrieving "https://ci.appveyor.com/api/buildjobs/hij3a6776pdv2007/artifacts/libxml2-2.9.4.win64.zip" to "build/extra\libxml2-2.9.4.win64.zip"
----------------------------------------
ERROR: Failed building wheel for xmlsec
Running setup.py clean for xmlsec
Failed to build xmlsec
Installing collected packages: xmlsec, python3-saml
Running setup.py install for xmlsec ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sekar\AppData\Local\conda\conda\envs\myvenv\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\sekar\AppData\Local\Temp\16\pip-install-9x0le85b\xmlsec\setup.py'"'"'; __file__='"'"'C:\Users\sekar\AppData\Local\Temp\16\pip-install-9x0le85b\xmlsec\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\sekar\AppData\Local\Temp\pip-record-l_q25m6k\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\sekar\AppData\Local\conda\conda\envs\myvenv\Include\xmlsec'
cwd: C:\Users\sekar\AppData\Local\Temp\pip-install-9x0le85b\xmlsec\
Complete output (5 lines):
running install
running build
running build_ext
error: HTTP Error 404: The specified blob does not exist.
Retrieving "https://ci.appveyor.com/api/buildjobs/hij3a6776pdv2007/artifacts/libxml2-2.9.4.win64.zip" to "build/extra\libxml2-2.9.4.win64.zip"
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\sekar\AppData\Local\conda\conda\envs\myvenv\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\sekar\AppData\Local\Temp\16\pip-install-9x0le85b\xmlsec\setup.py'"'"'; __file__='"'"'C:\Users\sekar\AppData\Local\Temp\16\pip-install-9x0le85b\xmlsec\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\sekar\AppData\Local\Temp\pip-record-l_q25m6k\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\sekar\AppData\Local\conda\conda\envs\myvenv\Include\xmlsec' Check the logs for full command output.
我试过 conda install python-saml
,同样的错误,他们在 2 年前就停止了这个包。即使我试过 python3-saml
核心问题在 xmlsec 包中..
有conda渠道或者PYPI提供这个包吗?
从未在此处使用 python-saml...但是,在搜索此错误时,我发现了这些 GitHub 问题:Issue 1 and Issue 2
他们都在谈论 dm.xmlsec.binding 的问题。
最佳,
费利佩
更新
从版本 1.3.7 开始,xmlsec
for Windows 的预构建轮子已在 PyPI 上发布,因此您应该不会再遇到此问题。
原回答
我已经重建了 xmlsec
windows 个轮子并将它们上传到 releases page of my fork。要安装,首先安装 xmlsec
并传递额外的 PyPI 索引:
$ pip install xmlsec --extra-index-url=https://hoefling.io/pypi
添加的索引只是代理对 Github 版本的安装请求。
现在安装 python3-saml
:
$ pip install python3-saml
(备选)手动选择距离
您可以从 releases page 中手动找到与您的 Python 安装相匹配的轮子,并使用直接 link 安装它,例如
$ python -c "from pip._internal.pep425tags import get_supported; print(*get_supported()[0], sep='-')"
cp37-cp37m-win_amd64
# the matching wheel is thus xmlsec-1.3.6.post1-cp37-cp37m-win_amd64.whl
$ pip install https://github.com/hoefling/xmlsec/releases/download/1.3.6.post1/xmlsec-1.3.6.post1-cp37-cp37m-win_amd64.whl
(可选)通过调用测试
验证xmlsec
是否有效
我已经对所有内置轮子执行了测试(查看 this job log on Appveyor),但您也可以 运行 在本地进行测试以验证 xmlsec
安装是否正常:
$ git clone https://github.com/mehcode/python-xmlsec.git && cd python-xmlsec
$ pip install pytest
$ pytest tests/