xmlsec 未安装在 Mac 上

问题描述 投票:0回答:1

我正在尝试使用 pysaml2 将 AWS 的 SSO 集成到我的 Flask 应用程序中,pysaml2 需要 xmlsec,但我在安装时遇到问题。

这是我收到的错误:

pip install xmlsec
Collecting xmlsec
  Using cached xmlsec-1.3.13.tar.gz (64 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: lxml>=3.8 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from xmlsec) (4.9.3)
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
  ╰─> [13 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-311
      creating build/lib.macosx-10.9-universal2-cpython-311/xmlsec
      copying src/xmlsec/py.typed -> build/lib.macosx-10.9-universal2-cpython-311/xmlsec
      copying src/xmlsec/tree.pyi -> build/lib.macosx-10.9-universal2-cpython-311/xmlsec
      copying src/xmlsec/__init__.pyi -> build/lib.macosx-10.9-universal2-cpython-311/xmlsec
      copying src/xmlsec/constants.pyi -> build/lib.macosx-10.9-universal2-cpython-311/xmlsec
      copying src/xmlsec/template.pyi -> build/lib.macosx-10.9-universal2-cpython-311/xmlsec
      running build_ext
      error: Unable to invoke pkg-config.
      [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

我已经安装了 homebrew 并安装了 libxml2、libxmlsec1 和 pkg-config。然而问题仍然存在。有谁知道解决办法吗

我也尝试过其他堆栈溢出问题的解决方案,但它们与我的情况并不完全匹配,并且不起作用。

python flask saml-2.0 xmlsec
1个回答
0
投票
  1. 检查
    pkg-config
    访问:确保
    pkg-config
    在您的路径中。
 which pkg-config

如果没有任何返回,则它不在您的路径中。

  1. 设置
    PKG_CONFIG_PATH
    : 安装前先设置路径:
 export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/libxmlsec1/lib/pkgconfig"
 pip install xmlsec
  1. 带日志记录的直接安装: 直接从源安装获取详细错误:
git clone https://github.com/mehcode/python-xmlsec.git
cd python-xmlsec
pip install -v .
  1. 使用虚拟环境: 创建一个隔离的 Python 环境并安装在:
python -m venv myenv
source myenv/bin/activate
pip install xmlsec
  1. 安装编译工具:
xcode-select --install
© www.soinside.com 2019 - 2024. All rights reserved.