簡體   English   中英

導入錯誤:沒有名為 dm.xmlsec.binding 的模塊

[英]ImportError: No module named dm.xmlsec.binding

我正在嘗試使用 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。

安裝部分,該軟件包具有一些外部依賴項:

依賴關系

  • 蟒蛇 2.7
  • dm.xmlsec.binding基於 Cython/lxml 的 XML 安全庫綁定(取決於 python-dev libxml2-dev libxmlsec1-dev)
  • isodate一個 ISO 8601 日期/時間/持續時間解析器和格式器
  • 用於 Python stdlib 模塊的defusedxml XML 炸彈保護

對於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環境中

打開終端並點擊以下命令

pip install dm.xmlsec.binding

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM