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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用pip安装Twisted for Python:错误:Microsoft Visual Studio失败,退出状态为2相关的知识,希望对你有一定的参考价值。

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

C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.14.26428inHostX86x86cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -Ic:usersdarioappdatalocalprogramspythonpython37-32include -Ic:usersdarioappdatalocalprogramspythonpython37-32include "-IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.14.26428include" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0um" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0cppwinrt" "-IC:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.14.26428include" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0um" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0cppwinrt" /Tcsrc/twisted/internet/iocpreactor/iocpsupport/iocpsupport.c /Fobuild	emp.win32-3.7Releasesrc/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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32includepystate.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:usersdarioappdatalocalprogramspythonpython37-32python.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('
', '
');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersdarioAppDataLocalTemppip-record-t02tl1qoinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersdarioAppDataLocalTemppip-install-3p6tzbh6Twisted

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

  • 更新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有语法错误
答案

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

另一答案

Twisted尚不支持Python 3.7。来自here

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

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

以上是关于使用pip安装Twisted for Python:错误:Microsoft Visual Studio失败,退出状态为2的主要内容,如果未能解决你的问题,请参考以下文章

windows下python3.6 通过pip安装Twisted模块报utf-8错误的解决办法

Win10上Python3通过pip install Twisted安装时出现UnicodeDecodeError

Python学习---IO的异步[twisted模块]

python3.5可以安装Twisted吗

Python——pip安装报错:is not a supported wheel on this platform

Pip不在Windows上安装Twisted