windows 错误:无法为pymssql生成wheel,安装基于pyproject.toml的项目需要pymssql

i7uaboj4  于 2022-12-19  发布在  Windows
关注(0)|答案(2)|浏览(381)

我在安装pymsql时遇到了问题,你们中有人遇到过类似的情况吗?
对于M1用户Link,我发现了类似的问题
我也试过:
使用以下内容升级pip:python -m pip安装--升级pip
升级轮盘:pip安装--升级轮
升级安装工具:pip安装--升级安装工具
当我尝试安装,然后我收到:

Collecting pymssql
  Using cached pymssql-2.2.2.tar.gz (170 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: startedNote: you may need to restart the kernel to use updated packages.
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: pymssql
  Building wheel for pymssql (pyproject.toml): started

  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\mikol\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\mikol\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\mikol\AppData\Local\Temp\tmpli4438o6'
       cwd: C:\Users\mikol\AppData\Local\Temp\pip-install-f4z0veo1\pymssql_f17e29cc25734af0a975be16add0d1d8
  Complete output (23 lines):
  setup.py: platform.system() => Windows
  setup.py: platform.architecture() => ('64bit', 'WindowsPE')
  setup.py: include_dirs => []
  setup.py: library_dirs => []
  running bdist_wheel
  running build  Building wheel for pymssql (pyproject.toml): finished with status 'error'
Failed to build pymssql

  running build_py
  creating build
  creating build\lib.win-amd64-3.10
  creating build\lib.win-amd64-3.10\pymssql
  copying src\pymssql\__init__.py -> build\lib.win-amd64-3.10\pymssql
  running build_ext
  cythoning src\pymssql\_mssql.pyx to src\pymssql\_mssql.c
  cythoning src\pymssql\_pymssql.pyx to src\pymssql\_pymssql.c
  building 'pymssql._mssql' extension
  creating build\temp.win-amd64-3.10
  creating build\temp.win-amd64-3.10\Release
  creating build\temp.win-amd64-3.10\Release\src
  creating build\temp.win-amd64-3.10\Release\src\pymssql
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\mikol\AppData\Local\Programs\Python\Python310\include -IC:\Users\mikol\AppData\Local\Programs\Python\Python310\Include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcsrc\pymssql\_mssql.c /Fobuild\temp.win-amd64-3.10\Release\src\pymssql\_mssql.obj -DMSDBLIB
  _mssql.c
  src\pymssql\_mssql.c(682): fatal error C1083: Nie moľna otworzy† pliku do\x88Ącz: 'sqlfront.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for pymssql
ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects

任何关于如何修复它的建议将不胜感激。

hfyxw5xn

hfyxw5xn1#

试试这个

sudo apt-get install python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
x6yk4ghg

x6yk4ghg2#

我不认为我将要说的是一个答案,但我确实喜欢芯片在可能帮助其他人谁可能会遇到这个在未来.(我打算写这作为一个评论,但我只有3代表点)
我的机器不是M1(它是运行Windows 10的英特尔CPU),我认为我的许多环境与OP不同,但我确实设法得到了错误,这与OP得到的很相似。
我最初也是通过"pip --no-cache-dir install pymssql“来解决这个问题的,效果很好。
但是,在那之后,我又遇到了一些错误(不是pymssql),这让我意识到我是在一个全新的Python 3.11.1操作系统上使用Python 3.10.4机器构建的requirement.txt文件来做“pip install -r requirement.txt
我没有意识到它会有这么大的不同,显然它有,总之,我想说的是,为什么module要为pymssql构建wheel,可能是因为你要安装的那个版本,可能不适合你的Python环境。
我怀疑这一点的原因是因为在我卸载了3.11.1并安装了3.10.4(这是我一开始就应该做的)之后,“pip install -r requirement.txt”工作起来很有魅力。
总之,这是我的两分钱。
仅供参考:我安装时遇到问题的pymssql版本是2.2.5

相关问题