使用pip安装Twisted for Python:错误:Microsoft Visual Studio失败,退出状态为2

问题描述 投票:3回答:2

当我尝试在运行python3.7的Windows 10机器上安装python包Twisted时,我无法从.tarz文件构建一个Wheel,我最终得到以下输出:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -Ic:\users\dario\appdata\local\programs\python\python37-32\include -Ic:\users\dario\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" /Tcsrc/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c /Fobuild\temp.win32-3.7\Release\src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.obj
iocpsupport.c
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(1933): warning C4047: '=': '__pyx_t_11iocpsupport_HANDLE' differs in levels of indirection from 'HANDLE'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(2077): warning C4022: 'CreateIoCompletionPort': pointer mismatch for actual parameter 1
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(2077): warning C4022: 'CreateIoCompletionPort': pointer mismatch for actual parameter 2
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(2077): warning C4047: '=': '__pyx_t_11iocpsupport_HANDLE' differs in levels of indirection from 'HANDLE'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(2192): warning C4022: 'GetQueuedCompletionStatus': pointer mismatch for actual parameter 1
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(2537): warning C4022: 'PostQueuedCompletionStatus': pointer mismatch for actual parameter 1
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(2648): warning C4022: 'CloseHandle': pointer mismatch for actual parameter 1
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7194): warning C4020: 'function through pointer': too many actual parameters
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7637): error C2039: 'exc_type': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7638): error C2039: 'exc_value': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7639): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7640): error C2039: 'exc_type': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7641): error C2039: 'exc_value': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7642): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7664): error C2039: 'exc_type': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7665): error C2039: 'exc_value': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7666): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7667): error C2039: 'exc_type': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7668): error C2039: 'exc_value': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7669): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7688): error C2039: 'exc_type': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7689): error C2039: 'exc_value': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7690): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7697): error C2039: 'exc_type': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7698): error C2039: 'exc_value': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7699): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7700): error C2039: 'exc_type': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7701): error C2039: 'exc_value': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
src/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c(7702): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\dario\appdata\local\programs\python\python37-32\include\pystate.h(209): note: see declaration of '_ts'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

----------------------------------------
Command "c:\users\dario\appdata\local\programs\python\python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\dario\\AppData\\Local\\Temp\\pip-install-3p6tzbh6\\Twisted\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\dario\AppData\Local\Temp\pip-record-t02tl1qo\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\dario\AppData\Local\Temp\pip-install-3p6tzbh6\Twisted\

我已尝试以下方法来解决此问题:

  • 更新Visual Studio构建工具2017
  • 更新pip和setuptools
  • 在Visual Studio构建工具2017中安装Windows 10 SDK
  • 从管理员命令提示符运行pip
  • 从Visual Studio x64 Native Tools命令提示符运行pip
  • 从这个站点安装一个轮子:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted哪个有效,但是当我运行Scrapy时,看起来扭曲是一个过时的版本,python 3.7有语法错误
visual-studio-2017 twisted python-3.7
2个回答
1
投票

请尝试从此发行版安装Twisted。这有助于我https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted


1
投票

Twisted尚不支持Python 3.7。来自here

Twisted尚不支持Python 3.7。由于语法更改和其他更改,以及此时构建基础架构的不可用性(例如,它不适用于Travis,我们还没有尝试过appveyor),我们还不能完全识别出错误并修复它充满信心。

您可以跟踪他们对Python 3.7支持here的进展。

© www.soinside.com 2019 - 2024. All rights reserved.