我正在尝试使用django-auth-ldap,所以首先我需要安装它。我试着做pip install django-auth-ldap,这给了我以下问题:
C:\Users\hansong.li\AppData\Local\Programs\Python\Python35-32\Scripts>pip install django-auth-ldap
Collecting django-auth-ldap
Using cached django_auth_ldap-1.2.8-py3-none-any.whl
Collecting pyldap (from django-auth-ldap)
Using cached pyldap-2.4.25.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): django in c:\users\hansong.li\appdata\local\programs\python\python35-32\lib\site-packages (from django-auth-ldap)
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\users\hansong.li\appdata\local\programs\python\python35-32\lib\site-packages (from pyldap->django-auth-ldap)
Installing collected packages: pyldap, django-auth-ldap
Running setup.py install for pyldap ... error
Complete output from command c:\users\hansong.li\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\hansong.li\\AppData\\Local\\Temp\\pip-build-bak9l5f6\\pyldap\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\hansong.li\AppData\Local\Temp\pip-z6tq2vvb-record\install-record.txt --single-version-externally-managed --compile:
defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
extra_compile_args:
extra_objects:
include_dirs: /usr/include /usr/include/sasl /usr/local/include /usr/local/include/sasl
library_dirs: /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64
libs: ldap_r
running install
running build
running build_py
file Lib\ldap.py (for module ldap) not found
file Lib\ldap\controls.py (for module ldap.controls) not found
file Lib\ldap\extop.py (for module ldap.extop) not found
file Lib\ldap\schema.py (for module ldap.schema) not found
creating build\lib.win32-3.5
copying Lib\ldapurl.py -> build\lib.win32-3.5
copying Lib\ldif.py -> build\lib.win32-3.5
copying Lib\dsml.py -> build\lib.win32-3.5
creating build\lib.win32-3.5\ldap
copying Lib\ldap\__init__.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\async.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\compat.py -> build\lib.win32-3.5\ldap
creating build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\__init__.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\deref.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\libldap.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\openldap.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\ppolicy.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\psearch.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\pwdpolicy.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\readentry.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\sessiontrack.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\controls\simple.py -> build\lib.win32-3.5\ldap\controls
copying Lib\ldap\cidict.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\dn.py -> build\lib.win32-3.5\ldap
creating build\lib.win32-3.5\ldap\extop
copying Lib\ldap\extop\__init__.py -> build\lib.win32-3.5\ldap\extop
copying Lib\ldap\extop\dds.py -> build\lib.win32-3.5\ldap\extop
copying Lib\ldap\filter.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\functions.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\ldapobject.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\logger.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\modlist.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\resiter.py -> build\lib.win32-3.5\ldap
copying Lib\ldap\sasl.py -> build\lib.win32-3.5\ldap
creating build\lib.win32-3.5\ldap\schema
copying Lib\ldap\schema\__init__.py -> build\lib.win32-3.5\ldap\schema
copying Lib\ldap\schema\models.py -> build\lib.win32-3.5\ldap\schema
copying Lib\ldap\schema\subentry.py -> build\lib.win32-3.5\ldap\schema
copying Lib\ldap\schema\tokenizer.py -> build\lib.win32-3.5\ldap\schema
copying Lib\ldap\syncrepl.py -> build\lib.win32-3.5\ldap
file Lib\ldap.py (for module ldap) not found
file Lib\ldap\controls.py (for module ldap.controls) not found
file Lib\ldap\extop.py (for module ldap.extop) not found
file Lib\ldap\schema.py (for module ldap.schema) not found
running egg_info
writing dependency_links to Lib\pyldap.egg-info\dependency_links.txt
writing requirements to Lib\pyldap.egg-info\requires.txt
writing Lib\pyldap.egg-info\PKG-INFO
writing top-level names to Lib\pyldap.egg-info\top_level.txt
warning: manifest_maker: standard file '-c' not found
file Lib\ldap.py (for module ldap) not found
file Lib\ldap\controls.py (for module ldap.controls) not found
file Lib\ldap\extop.py (for module ldap.extop) not found
file Lib\ldap\schema.py (for module ldap.schema) not found
reading manifest file 'Lib\pyldap.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'Makefile'
warning: no files found matching 'LICENCE'
warning: no files found matching 'Modules\LICENSE'
writing manifest file 'Lib\pyldap.egg-info\SOURCES.txt'
running build_ext
building '_ldap' extension
creating build\temp.win32-3.5
creating build\temp.win32-3.5\Release
creating build\temp.win32-3.5\Release\Modules
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.25.1 -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -Ic:\users\hansong.li\appdata\local\programs\python\python35-32\include -Ic:\users\hansong.li\appdata\local\programs\python\python35-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /TcModules/LDAPObject.c /Fobuild\temp.win32-3.5\Release\Modules/LDAPObject.obj
LDAPObject.c
c:\users\hansong.li\appdata\local\temp\pip-build-bak9l5f6\pyldap\modules\errors.h(8): fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\users\hansong.li\appdata\local\programs\python\python35-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\hansong.li\\AppData\\Local\\Temp\\pip-build-bak9l5f6\\pyldap\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\hansong.li\AppData\Local\Temp\pip-z6tq2vvb-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\hansong.li\AppData\Local\Temp\pip-build-bak9l5f6\pyldap\
然后我尝试下载它的Windows二进制文件,并尝试:
C:\Users\hansong.li\AppData\Local\Programs\Python\Python35-32\Scripts>pip install C:\Users\hansong.li\Downloads\python-ldap-2.4.27
Processing c:\users\hansong.li\downloads\python-ldap-2.4.27
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\hansong.li\AppData\Local\Temp\pip-4d49q60t-build\setup.py", line 53
print name + ': ' + cfg.get('_ldap', name)
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\hansong.li\AppData\Local\Temp\pip-4d49q60t-build\
我还尝试下载滚轮并从那里安装,它也失败了,看起来就像第一个错误。现在我对如何解决这个问题感到很困惑。