繁体   English   中英

在 Centos 8 上安装 django-auth-ldap 时出现问题

[英]Problem installing django-auth-ldap on Centos 8

我在 Centos8 上完成 netbox 安装时遇到问题。 Netbox 可与 Gunicorn 和 Apache 配合使用。 我想添加 LDAP auth 但是 django-auth-ldap 安装有问题。 我有虚拟环境和 python 3.9 版。 Pip 是最新的 (21.3.1)。 你能告诉我为什么我得到这个错误,我该怎么办?

(venv) server # python -m pip --proxy http://x.x.x.x:8080 install django-auth-ldap
Collecting django-auth-ldap
  Using cached django_auth_ldap-4.0.0-py3-none-any.whl (20 kB)
Collecting python-ldap>=3.1
  Using cached python-ldap-3.4.0.tar.gz (376 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: Django>=2.2 in /opt/netbox-3.1.6/venv/lib/python3.9/site-packages (from django-auth-ldap) (3.2.11)
Requirement already satisfied: sqlparse>=0.2.2 in /opt/netbox-3.1.6/venv/lib/python3.9/site-packages (from Django>=2.2->django-auth-ldap) (0.4.2)
Requirement already satisfied: pytz in /opt/netbox-3.1.6/venv/lib/python3.9/site-packages (from Django>=2.2->django-auth-ldap) (2021.3)
Requirement already satisfied: asgiref<4,>=3.3.2 in /opt/netbox-3.1.6/venv/lib/python3.9/site-packages (from Django>=2.2->django-auth-ldap) (3.4.1)
Requirement already satisfied: pyasn1-modules>=0.1.5 in /opt/netbox-3.1.6/venv/lib/python3.9/site-packages (from python-ldap>=3.1->django-auth-ldap) (0.2.8)
Requirement already satisfied: pyasn1>=0.3.7 in /opt/netbox-3.1.6/venv/lib/python3.9/site-packages (from python-ldap>=3.1->django-auth-ldap) (0.4.8)
Building wheels for collected packages: python-ldap
  Building wheel for python-ldap (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/netbox-3.1.6/venv/bin/python /opt/netbox-3.1.6/venv/lib64/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpo78utvm4
       cwd: /tmp/pip-install-bnfhe42v/python-ldap_e4bf3926de1e4da5a798e591556ac981
  Complete output (75 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  copying Lib/ldapurl.py -> build/lib.linux-x86_64-3.9
  copying Lib/ldif.py -> build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/resiter.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/sasl.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/modlist.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/async.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/constants.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/filter.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/asyncsearch.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/cidict.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/ldapobject.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/compat.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/functions.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/pkginfo.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/__init__.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/syncrepl.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/logger.py -> build/lib.linux-x86_64-3.9/ldap
  copying Lib/ldap/dn.py -> build/lib.linux-x86_64-3.9/ldap
  creating build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/readentry.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/pagedresults.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/openldap.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/psearch.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/libldap.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/ppolicy.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/__init__.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/deref.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/sessiontrack.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/simple.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/vlv.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/pwdpolicy.py -> build/lib.linux-x86_64-3.9/ldap/controls
  copying Lib/ldap/controls/sss.py -> build/lib.linux-x86_64-3.9/ldap/controls
  creating build/lib.linux-x86_64-3.9/ldap/extop
  copying Lib/ldap/extop/dds.py -> build/lib.linux-x86_64-3.9/ldap/extop
  copying Lib/ldap/extop/passwd.py -> build/lib.linux-x86_64-3.9/ldap/extop
  copying Lib/ldap/extop/__init__.py -> build/lib.linux-x86_64-3.9/ldap/extop
  creating build/lib.linux-x86_64-3.9/ldap/schema
  copying Lib/ldap/schema/__init__.py -> build/lib.linux-x86_64-3.9/ldap/schema
  copying Lib/ldap/schema/subentry.py -> build/lib.linux-x86_64-3.9/ldap/schema
  copying Lib/ldap/schema/models.py -> build/lib.linux-x86_64-3.9/ldap/schema
  copying Lib/ldap/schema/tokenizer.py -> build/lib.linux-x86_64-3.9/ldap/schema
  creating build/lib.linux-x86_64-3.9/slapdtest
  copying Lib/slapdtest/_slapdtest.py -> build/lib.linux-x86_64-3.9/slapdtest
  copying Lib/slapdtest/__init__.py -> build/lib.linux-x86_64-3.9/slapdtest
  running egg_info
  no previously-included directories found matching 'Doc/.build'
  writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
  creating build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/README -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/ca.conf -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/ca.pem -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/client.conf -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/client.key -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/client.pem -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/gencerts.sh -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/gennssdb.sh -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/server.conf -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/server.key -> build/lib.linux-x86_64-3.9/slapdtest/certs
  copying Lib/slapdtest/certs/server.pem -> build/lib.linux-x86_64-3.9/slapdtest/certs
  running build_ext
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/Modules
  gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=3.4.0 "-DLDAPMODULE_AUTHOR=python-ldap project" "-DLDAPMODULE_LICENSE=Python style" -IModules -I/opt/netbox-3.1.6/venv/include -I/usr/include/python3.9 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-3.9/Modules/LDAPObject.o
  In file included from Modules/LDAPObject.c:3:
  Modules/common.h:9:10: fatal error: Python.h: No such file or directory
   #include "Python.h"
            ^~~~~~~~~~
  compilation terminated.
  error: command '/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for python-ldap
Failed to build python-ldap
ERROR: Could not build wheels for python-ldap, which is required to install pyproject.toml-based projects

我明白了:我必须安装:

yum groupinstall "Development tools"
yum install openldap-devel 
yum install python39-devel

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM