【发布时间】:2014-02-16 04:11:48
【问题描述】:
我在 32 位和 64 位版本的基于 Windows 的环境(2003、win 7、2008 r2 等)上运行 Python。我最近不得不使用 NTLM 和 Kerberos 身份验证方案对各种面向内部的公司网站进行身份验证。
我使用“请求”模块成功进行了 NTLM 身份验证。具体来说,有一些文档讨论了Other Authentication 的方法。安装“requests-ntlm”包效果很好!
不幸的是,我似乎无法让 requests-kerberos 包工作。 requirements.txt 表明需要 kerberos-1.1.1 包,但我无法构建/安装该包。
如果我尝试在没有 kerberos-1.1.1 的情况下导入 requests-kerberos 库,会发生以下情况:
>>> import requests
>>> from requests_kerberos import HTTPKerberosAuth
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "requests_kerberos\__init__.py", line 17, in <module>
from .kerberos_ import HTTPKerberosAuth, REQUIRED, OPTIONAL, DISABLED
File "requests_kerberos\kerberos_.py", line 1, in <module>
import kerberos
ImportError: No module named kerberos
>>>
这是我尝试从我的一台 WIN 7 机器(使用 python 2.6.5)构建 kerberos-1.1.1 包时的错误:
>python setup.py install --install-lib "C:\tmp"
running install
running build
running build_ext
building 'kerberos' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -IC:\Python26\ArcGIS10.0\include -IC:\Python26\ArcGIS10.0\
PC /Tcsrc/kerberos.c /Fobuild\temp.win32-2.6\Release\src/kerberos.obj '{' is not
recognized as an internal or external command, operable program or batch file.
cl : Command line warning D9024 : unrecognized source file type ''{'', object fi
le assumed
cl : Command line warning D9027 : source file ''{'' ignored
cl : Command line warning D9024 : unrecognized source file type 'is', object fil
e assumed
cl : Command line warning D9027 : source file 'is' ignored
cl : Command line warning D9024 : unrecognized source file type 'not', object fi
le assumed
cl : Command line warning D9027 : source file 'not' ignored
cl : Command line warning D9024 : unrecognized source file type 'recognized', ob
ject file assumed
cl : Command line warning D9027 : source file 'recognized' ignored
cl : Command line warning D9024 : unrecognized source file type 'as', object fil
e assumed
cl : Command line warning D9027 : source file 'as' ignored
cl : Command line warning D9024 : unrecognized source file type 'an', object fil
e assumed
cl : Command line warning D9027 : source file 'an' ignored
cl : Command line warning D9024 : unrecognized source file type 'internal', obje
ct file assumed
cl : Command line warning D9027 : source file 'internal' ignored
cl : Command line warning D9024 : unrecognized source file type 'or', object fil
e assumed
cl : Command line warning D9027 : source file 'or' ignored
cl : Command line warning D9024 : unrecognized source file type 'external', obje
ct file assumed
cl : Command line warning D9027 : source file 'external' ignored
cl : Command line warning D9024 : unrecognized source file type 'command,', obje
ct file assumed
cl : Command line warning D9027 : source file 'command,' ignored
cl : Command line warning D9024 : unrecognized source file type 'operable', obje
ct file assumed
cl : Command line warning D9027 : source file 'operable' ignored
cl : Command line warning D9024 : unrecognized source file type 'program', objec
t file assumed
cl : Command line warning D9027 : source file 'program' ignored
cl : Command line warning D9024 : unrecognized source file type 'or', object fil
e assumed
cl : Command line warning D9027 : source file 'or' ignored
cl : Command line warning D9024 : unrecognized source file type 'batch', object
file assumed
cl : Command line warning D9027 : source file 'batch' ignored
cl : Command line warning D9024 : unrecognized source file type 'file.', object
file assumed
cl : Command line warning D9027 : source file 'file.' ignored
kerberos.c
\src\kerberosbasic.h(17) : fatal error C108
3: Cannot open include file: 'gssapi/gssapi.h': No such file or directory
error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.ex
e"' failed with exit status 2
我也尝试过我的一台 WIN 2008 R2 服务器(使用 python 2.7.2),但得到一个不同的错误:
>python.exe "setup.py" install --
install-lib "C:\tmp"
running install
running build
running build_ext
building 'kerberos' extension
error: Unable to find vcvarsall.bat
我认为这与这些是从源代码构建的并且需要某种 C 或 C++ 编译器有关,而我过去安装的大多数其他模块都运行良好。任何建议表示赞赏!
【问题讨论】:
标签: python authentication kerberos ntlm