【发布时间】:2023-11-20 21:10:01
【问题描述】:
遇到以下错误但也得到了解决方案,您只需执行以下步骤
- 转到https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyodbc
- 下载合适的 '".whl"' 文件(确保选择正确的 whl 文件。例如:如果您在 64 位机器上使用 Python 2.7,请选择 '''pyodbc-4.0.32-cp310-cp310 -win_amd64.whl'''。)
- 运行 '''pip install pyodbc-4.0.32-cp310-cp310-win_amd64.whl''' 并重试
这是错误
为 pyodbc 运行 setup.py install ... 错误
错误:命令出错,退出状态为 1:
命令:'C:\x\x\x\x\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\xxxx\x\x\Local\Temp\pip-install-8j3hztgx\pyodbc_b5b6921fa34f4725a66d9248ff07177c\setup.py'"'"'; 文件='"'"'C:\Users\x\AppData\Local\Temp\pip-install-8j3hztgx\pyodbc_b5b6921fa34f4725a66d9248ff07177c\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"' from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"' "');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\x \AppData\Local\Temp\pip-record-e9qbaui4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\x\AppData\Local\Programs\ Python\Python310\包含\pyodbc'
cwd: C:\Users\x\AppData\Local\Temp\pip-install-8j3hztgx\pyodbc_b5b6921fa34f4725a66d9248ff07177c
完整输出(12 行):
运行安装
运行构建
运行 build_ext
构建“pyodbc”扩展
创建构建
创建 build\temp.win-amd64-3.10
创建 build\temp.win-amd64-3.10\Release
创建 build\temp.win-amd64-3.10\Release\src
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYODBC_VERSION= 4.0.32 -IC:\Users\x\AppData\Local\Programs\Python\Python310\include -IC:\Users\x\AppData\Local\Programs\Python\Python310\Include -IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um /EHsc /T C:\Users\x\AppData\Local \Temp\pip-install-8j3hztgx\pyodbc_b5b6921fa34f4725a66d9248ff07177c\src\pyodbc.h(19):致命错误 C1083:无法打开包含文件:'windows.h':没有这样的文件或目录
错误:命令 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe' 因 ex 而失败 --------- -------------------------------------------
错误:命令出错,退出状态为 1:'C:\Users\x\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools,
标记化; sys.argv[0] = '"'"'C:\Users\x\AppData\Local\Temp\pip-install-8j3hztgx\pyodbc_b5b6921fa34f4725a66d9248ff07177c\setup.py'"'"'; __file_n'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f .close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\x\AppData\Local\ Temp\pip-record-e9qbaui4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\x\AppData\Local\Programs\Python\Python310\Include \pyodbc' 切
【问题讨论】: