pip install python-qpid-proton:如何修复 windows 上的错误?

pip install python-qpid-proton: how to fix errors on windows?

虽然 运行 pip install python-qpid-proton 我得到了以下错误:

  1. 错误:需要 Microsoft Visual C++ 14.0 或更高版本。
    我通过安装 Visual Studio Build Tools 2022 和 Visual Studio Professional 2022

    解决了这个问题
  2. 致命错误 C1083:无法打开编译器生成的文件
    如果路径太长,此错误会明显出现。因此,我将 Temp 文件夹的路径更改为较短的路径。我通过在 C:\Windows\TEMP 下创建一个新文件夹并更改设置以下环境变量来完成此操作:
    TEMP=C:\TEMP 和 TMP=C:\TEMP

  3. 在这两个步骤之后,我得到了一个不同的错误。有人知道如何解决这个问题吗?也许还有一种不同的方法可以在 windows 上安装 python-qpid-proton?非常感谢...

错误是在这种形式的大量警告之后出现的

C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\src\core\buffer.c(279): warning C4267: '+=': conversion from 'size_t' to 'unsigned int', possible loss of data  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\src\core\buffer.c(280): warning C4267: '-=': conversion from 'size_t' to 'unsigned int', possible loss of data  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\src\core\buffer.c(273): warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data

然后是错误:

cproton_wrap.c  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/object.h(242): error C2061: syntax error: identifier 
'pn_list_index'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/object.h(242): error C2059: syntax error: ';'         
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/object.h(242): error C2059: syntax error: '<parameter
-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/object.h(280): error C2061: syntax error: identifier 
'pn_string_put'
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/object.h(280): error C2059: syntax error: ';'        
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/object.h(280): error C2059: syntax error: '<parameter
-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(546): error C2061: syntax error: identifier '
pn_data_encode'
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(546): error C2059: syntax error: ';'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(546): error C2059: syntax error: '<parameter-
list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(555): error C2061: syntax error: identifier '  
pn_data_encoded_size'
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(555): error C2059: syntax error: ';'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(555): error C2059: syntax error: '<parameter-
list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(574): error C2061: syntax error: identifier '
pn_data_decode'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(574): error C2059: syntax error: ';'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/codec.h(574): error C2059: syntax error: '<parameter-
list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/link.h(587): error C2061: syntax error: identifier 'p
n_link_send'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/link.h(587): error C2059: syntax error: ';'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/link.h(587): error C2059: syntax error: '<parameter-l
ist>'   
 C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/link.h(640): error C2061: syntax error: identifier 'p
n_link_recv'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/link.h(640): error C2059: syntax error: ';'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/link.h(640): error C2059: syntax error: '<parameter-l
ist>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(489): error C2061: syntax error: identifi  
er 'pn_transport_input'
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(489): error C2059: syntax error: ';'       
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(489): error C2059: syntax error: '<parame
ter-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(494): error C2061: syntax error: identifi  
er 'pn_transport_output'
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(494): error C2059: syntax error: ';'     
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(494): error C2059: syntax error: '<parame
ter-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(513): error C2061: syntax error: identifi
er 'pn_transport_capacity'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(513): error C2059: syntax error: ';'     
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(513): error C2059: syntax error: '<parame
ter-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(546): error C2061: syntax error: identifi
er 'pn_transport_push'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(546): error C2059: syntax error: ';'     
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(546): error C2059: syntax error: '<parame
ter-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(593): error C2061: syntax error: identifier 'pn_transport_pending'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(593): error C2059: syntax error: ';'     
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(593): error C2059: syntax error: '<parame
ter-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(625): error C2061: syntax error: identifi
er 'pn_transport_peek'
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(625): error C2059: syntax error: ';'     
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/transport.h(625): error C2059: syntax error: '<parame
ter-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/message.h(752): error C2061: syntax error: identifier
 'pn_message_encode2'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/message.h(752): error C2059: syntax error: ';'       
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/message.h(752): error C2059: syntax error: '<paramete
r-list>'  
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/message.h(777): error C2061: syntax error: identifier
 'pn_message_send'  
      C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/message.h(777): error C2059: syntax error: ';'       
C:\Temp\pip-install-rv64pyj0\python-qpid-proton_043295171d11447ab93794ab575dd56d\include\proton/message.h(777): error C2059: syntax error: '<paramete
r-list>'  
      cproton_wrap.c(3131): error C2061: syntax error: identifier 'wrap_pn_link_recv'  
      cproton_wrap.c(3131): error C2059: syntax error: ';'  
      cproton_wrap.c(3131): error C2059: syntax error: '<parameter-list>'  
      cproton_wrap.c(3142): error C2061: syntax error: identifier 'wrap_pn_transport_peek'  
      cproton_wrap.c(3142): error C2059: syntax error: ';'  
      cproton_wrap.c(3142): error C2059: syntax error: '<parameter-list>'  
      cproton_wrap.c(3191): error C2061: syntax error: identifier 'wrap_pn_data_encode'  
      cproton_wrap.c(3191): error C2059: syntax error: ';'  
      cproton_wrap.c(3191): error C2059: syntax error: '<parameter-list>'  
      cproton_wrap.c(3760): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(3760): error C2146: syntax error: missing ';' before identifier 'result'  
      cproton_wrap.c(3760): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3784): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3784): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(3784): error C2146: syntax error: missing ';' before identifier 'pn_link_send'  
      cproton_wrap.c(3784): warning C4013: 'pn_link_send' undefined; assuming extern returning int  
      cproton_wrap.c(3787): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3806): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(3806): error C2146: syntax error: missing ';' before identifier 'result'  
      cproton_wrap.c(3806): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3824): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3824): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(3824): error C2146: syntax error: missing ';' before identifier  
 'wrap_pn_link_recv'   
      cproton_wrap.c(3824): warning C4013: 'wrap_pn_link_recv' undefined; assuming extern returning int    
      cproton_wrap.c(3827): error C2065: 'result': undeclared identifier    
      cproton_wrap.c(3845): error C2065: 'ssize_t': undeclared identifier    
      cproton_wrap.c(3845): error C2146: syntax error: missing ';' before identifier 'result'  
      cproton_wrap.c(3845): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3869): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3869): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(3869): error C2146: syntax error: missing ';' before identifier  'pn_transport_push'  
      cproton_wrap.c(3869): warning C4013: 'pn_transport_push' undefined; assuming extern returning int  
      cproton_wrap.c(3872): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3891): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(3891): error C2146: syntax error: missing ';' before identifier 'result'  
      cproton_wrap.c(3891): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3909): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(3909): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(3909): error C2146: syntax error: missing ';' before identifier  
 'wrap_pn_transport_peek'  
      cproton_wrap.c(3909): warning C4013: 'wrap_pn_transport_peek' undefined; assuming extern returning int  
      cproton_wrap.c(3912): error C2065: 'result': undeclared identifier   
      cproton_wrap.c(4005): error C2065: 'ssize_t': undeclared identifier   
      cproton_wrap.c(4005): error C2146: syntax error: missing ';' before identifier 'result'   
      cproton_wrap.c(4005): error C2065: 'result': undeclared identifier    
      cproton_wrap.c(4029): error C2065: 'result': undeclared identifier    
      cproton_wrap.c(4029): error C2065: 'ssize_t': undeclared identifier    
      cproton_wrap.c(4029): error C2146: syntax error: missing ';' before identifier 'pn_data_decode'    
      cproton_wrap.c(4029): warning C4013: 'pn_data_decode' undefined; assuming extern returning int  
      cproton_wrap.c(4032): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(4051): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(4051): error C2146: syntax error: missing ';' before identifier 'result'  
      cproton_wrap.c(4051): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(4069): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(4069): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(4069): error C2146: syntax error: missing ';' before identifier 'wrap_pn_data_encode'  
      cproton_wrap.c(4069): warning C4013: 'wrap_pn_data_encode' undefined; assuming extern returning int  
      cproton_wrap.c(4072): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(12214): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(12214): error C2146: syntax error: missing ';' before identifier 'result'  
      cproton_wrap.c(12214): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(12234): error C2065: 'result': undeclared identifier  
      cproton_wrap.c(12234): error C2065: 'ssize_t': undeclared identifier  
      cproton_wrap.c(12234): fatal error C1003: error count exceeds 100; stopping compilation
      error: command 'C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe' failed with 
exit code 2`    

我使用 Python 3.9 而不是 Python 3.10 修复了最后一个错误。显然 python-qpid-proton 0.37.0 只兼容 Python 3.9.