在 Windows 中安装适用于 Python 的 thrift_sasl

Rah*_*hul 5 python mingw pip sasl visual-c++

我一直在尝试在 Windows 10 x64 中安装该thrift_sasl软件包pip

thrift_sasl取决于sasl软件包,但在运行pip install thrift_sasl或 时pip install sasl,我遇到了同样的错误。

creating build\temp.win-amd64-2.7\Release\sasl
C:\Users\user\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isasl -Ic:\python27\include -Ic:\python27\PC /Tpsasl/saslwrapper.cpp /Fobuild\temp.win-amd64-2.7\Release\sasl/saslwrapper.obj
saslwrapper.cpp
sasl/saslwrapper.cpp(247) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command 'C:\\Users\\user\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
Run Code Online (Sandbox Code Playgroud)

该问题可能是因为 Visual C++ for Python 不支持较旧的 c 头文件。有人可以帮我安装吗?

编辑:我安装了 mingw,并尝试--compiler=mingw32使用pip. 现在它给了我以下错误:

C:\MinGW\bin\gcc.exe -mdll -O -Wall -Isasl -Ic:\python27\include -Ic:\python27\PC -c sasl/saslwrapper.cpp -o build\temp.win-amd64-2.7\Release\sasl\saslwrapper.o
In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
 #include <sasl/sasl.h>
                       ^
compilation terminated.
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

编辑2:我下载了Cyrus sasl C库并将头文件复制到mingw查找头文件的文件夹(即C:\MinGW\lib\gcc\mingw32\4.9.3\include\sasl)。现在,我收到此错误:

In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h: In member function 'void saslwrapper::ClientImpl::interact(sasl_interact_t*)':
sasl/saslwrapper.h:442:41: error: 'getpass' was not declared in this scope
         char* pass = getpass(ppt.c_str());
                                         ^
sasl/saslwrapper.h:437:11: warning: unused variable 'input' [-Wunused-variable]
     char* input;
           ^
sasl/saslwrapper.cpp: In function 'void __Pyx_RaiseArgtupleInvalid(const char*, int, Py_ssize_t, Py_ssize_t, Py_ssize_t)':
sasl/saslwrapper.cpp:3225:59: warning: unknown conversion type character 'z' in format [-Wformat=]
                  (num_expected == 1) ? "" : "s", num_found);
                                                           ^
sasl/saslwrapper.cpp:3225:59: warning: format '%s' expects argument of type 'char*', but argument 5 has type 'Py_ssize_t {aka int}' [-Wformat=]
sasl/saslwrapper.cpp:3225:59: warning: unknown conversion type character 'z' in format [-Wformat=]
sasl/saslwrapper.cpp:3225:59: warning: too many arguments for format [-Wformat-extra-args]
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

看来我下载的sasl库没有任何功能getpass。我环顾四周,发现该getpass函数仅适用于 Linux 并更改终端状态,如linux 手册页所示。我从这里下载了该库。有任何解决方法的想法吗?

Wil*_*ard -2

如果您没有安装 Chocolatey,请按照以下说明安装Chocolatey install

然后尝试

choco install msinttypes
Run Code Online (Sandbox Code Playgroud)

从命令提示符。

然后再次尝试安装 thrift_sasl