首页 > 解决方案 > 安装 setup.py for twisted for django 频道时出错

问题描述

我在 vscode bash 终端中得到的错误日志


C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -Ic:\users\flowers\appdata\local\programs\python\python38\include -Ic:\users\flowers\appdata\local\programs\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" /Tcsrc/twisted/test/raiser.c /Fobuild\temp.win-amd64-3.8\Release\src/twisted/test/raiser.obj
    raiser.c
    c:\users\flowers\appdata\local\programs\python\python38\include\pyconfig.h(206): fatal error C1083: Cannot open include file: 'basetsd.h': No
such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\flowers\appdata\local\programs\python\py
 tokenize; sys.argv[0] = '"'"'C:\\Users\\Flowers\\AppData\\Local\\Temp\\pip-install-zc2kyt8z\\twi
wers\\AppData\\Local\\Temp\\pip-install-zc2kyt8z\\twisted\\setup.py'"'"';f=getattr(tokenize, '"'"
('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install -
record-m_o3jpo7\install-record.txt' --single-version-externally-managed --compile --install-heade
n\python38\Include\twisted' Check the logs for full command output.

在此错误之前,我收到错误消息说您需要安装visual c++ 14.0 build tools一些东西,然后我按照建议中的链接下载了 vs 构建工具并单独下载并安装了 vsredit 2019 但现在我收到此错误请帮助我,我不知道该怎么做只想在我的项目中使用 django 频道....

我已经尝试使用我安装的构建工具安装频道,但它仍然无法正常工作这些包也有 windows 通用 cdr(类似这样的) SDK。我正在使用 Windows 7 64 位

标签: visual-studiodjango-channels

解决方案


参考这个链接: https ://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

为你的 python 版本下载正确的 whl 包(如果你不知道你有什么版本的 python,只需午餐解释器),在我的情况下它是 python 3.6 32 位

使用 pip 安装包,假设文件在下载文件夹中: python -m pip install C:\Users%USER%\Downloads\Twisted-17.9.0-cp36-cp36m-win32.whl

然后,您可以尝试使用 pip 再次安装频道


推荐阅读