微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

错误:无法为使用 PEP 517 且无法直接安装的 pymssql 构建轮子

如何解决错误:无法为使用 PEP 517 且无法直接安装的 pymssql 构建轮子

我正在尝试从 Windows 上的 pip 安装 pymssql。问题是,我不断收到以下错误

ERROR: Failed building wheel for pymssql
Failed to build pymssql
ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly

完整日志如下:

Building wheels for collected packages: pymssql
  Building wheel for pymssql (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\administrator\appdata\local\programs\python\python39\python.exe' 'c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\ADMINI~1\AppData\Local\Temp\tmpvh65n1en'
       cwd: C:\Users\Administrator\AppData\Local\Temp\pip-install-skfrg8ce\pymssql_3826b234076b47ab9618e9d73ff9698b
  Complete output (16 lines):
  setup.py: platform.system() => 'Windows'
  setup.py: platform.architecture() => ('64bit','WindowsPE')
  running bdist_wheel
  running build
  running build_ext
  cythoning src\_mssql.pyx to src\_mssql.c
  cythoning src\pymssql.pyx to src\pymssql.c
  building '_mssql' extension
  creating build
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\src
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ifreetds\include -IC:\Users\Administrator\AppData\Local\Temp\pip-install-skfrg8ce\pymssql_3826b234076b47ab9618e9d73ff9698b\build\include -Ic:\users\administrator\appdata\local\programs\python\python39\include -Ic:\users\administrator\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /Tcsrc\_mssql.c /Fobuild\temp.win-amd64-3.9\Release\src\_mssql.obj -DMSDBLIB
  _mssql.c
  src\_mssql.c(611): Fatal error C1083: Cannot open include file: 'sqlfront.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' Failed with exit code 2

有人遇到过这个问题吗?我已经搜索了很远很远,但没有答案。我尝试降级 pip 并尝试安装旧版本的 pymssql,但没有成功。

解决方法

您缺少构建扩展所需的一些头文件(可能还有库)。

除非您想从头开始构建,否则从 Dave Gohlke's Windows wheels page 获取合适的预构建轮子并使用 Pip 安装它可能会更容易。请务必为您的 Python 版本和位数选择正确的文件。

,

我遇到同样的错误,不同的解决方案。

我使用的是 mac + py3.9

解决方案:

brew install freetds

错误信息:

Collecting pymssql
  Using cached pymssql-2.1.5.tar.gz (167 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: pymssql
  Building wheel for pymssql (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.9/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/ch/88r0y0hx02v5v903bl4pf4c40000gn/T/tmp053ptsxm
       cwd: /private/var/folders/ch/88r0y0hx02v5v903bl4pf4c40000gn/T/pip-install-klunmran/pymssql
  Complete output (33 lines):
  setup.py: platform.system() => 'Darwin'
  setup.py: platform.architecture() => ('64bit','')
  setup.py: platform.libc_ver() => ('','')
  setup.py: Detected Darwin/Mac OS X.
      You can install FreeTDS with Homebrew or MacPorts,or by downloading
      and compiling it yourself.

      Homebrew (http://brew.sh/)
      --------------------------
      brew install freetds

      MacPorts (http://www.macports.org/)
      -----------------------------------
      sudo port install freetds

  setup.py: Not using bundled FreeTDS
  setup.py: include_dirs = ['/usr/local/include']
  setup.py: library_dirs = ['/usr/local/lib']
  running bdist_wheel
  running build
  running build_ext
  cythoning src/_mssql.pyx to src/_mssql.c
  cythoning src/pymssql.pyx to src/pymssql.c
  building '_mssql' extension
  creating build
  creating build/temp.macosx-10.15-x86_64-3.9
  creating build/temp.macosx-10.15-x86_64-3.9/src
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_mssql.c -o build/temp.macosx-10.15-x86_64-3.9/src/_mssql.o -DMSDBLIB
  src/_mssql.c:611:10: fatal error: 'sqlfront.h' file not found
  #include "sqlfront.h"
           ^~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pymssql
Failed to build pymssql
ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?