visual-studio-2017 - 使用 pip : error: Microsoft Visual Studio failed with exit status 2 为 Python 安装 Twisted

标签 visual-studio-2017 twisted python-3.7

当我尝试在运行 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 工具命令提示符运行 pip
  • 从此站点安装轮子:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
    这确实有效,但是当我运行 Scrapy 时,它似乎是一个过时的版本,并且 python 3.7
  • 存在语法错误。

    最佳答案

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

    关于visual-studio-2017 - 使用 pip : error: Microsoft Visual Studio failed with exit status 2 为 Python 安装 Twisted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51830649/

    相关文章:

    visual-studio - 将Visual Studio 2017与.Net Core SDK 2.0一起使用

    .net-core - .NET Core 解决方案红色代码但构建

    PyCharm 中的 Pandas : Where does it display the boxplot?

    python - pygame 如何从屏幕的每一侧生成敌人?

    c++ - Visual Studio 2017 C++ : Missing includes on cloned git repository

    visual-studio - 在带有.NET Core项目的Visual Studio中将文件显示在其他文件之下

    python - Twisted RPC 消息聚合

    python - 扭曲为 python : Is there an ETA or beta for python v3?

    python - 使用 django 并扭曲在一起

    python - 使用主题 ttk TreeView 时 tag_configure 不起作用