1

我正在尝试使用 oneLogin python-saml 库(https://github.com/onelogin/python-saml)在 Python 2.7 中的 Django(1.7 版)应用程序中实现 SAML2.0,但我在下面收到此错误:

import dm.xmlsec.binding as xmlsec
ImportError: No module named dm.xmlsec.binding

当我尝试在我的机器上安装这个特定的库时,我收到了这个错误:

Collecting dm.xmlsec.binding
  Using cached https://files.pythonhosted.org/packages/56/30/7d19e02398b46593c7a72589c767c50f1ff4a96845f5bc6c61c3183fb213/dm.xmlsec.binding-2.0.tar.gz
    Complete output from command python setup.py egg_info:
    Error: cannot get XMLSec1 pre-processor and compiler flags; do you have the `libxmlsec1` development package installed?

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-W3sKpb/dm.xmlsec.binding/

请让我知道我应该使用哪些库在 python2 中实现 SAML2。

4

2 回答 2

2

安装部分,该包具有一些外部依赖项:

依赖项

对于dm.xmlsec.binding,您需要安装libxmlsec1-dev.

根据您的平台:

  • Debian/Ubuntu

    $ sudo apt-get install libxmlsec1-dev
    
  • OS X(使用Homebrew

    $ brew install libxmlsec1
    

然后安装依赖

$ pip install dm.xmlsec.binding

OR

$ python -m pip install dm.xmlsec.binding

确保将其安装在与python您的应用程序相同的环境中)

于 2020-01-29T07:05:24.697 回答
0

打开终端并点击以下命令

pip install dm.xmlsec.binding
于 2020-01-29T06:39:18.293 回答