繁体   English   中英

错误:无法为 pymssql 构建轮子,这是在 Mac M1 中安装基于 pyproject.toml 的项目所必需的

[英]ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects In Mac M1

我正在使用带有 M1 芯片的 MacBook,似乎很多东西都没有针对它进行优化。
pyodbc对我不起作用,所以我想使用pymssql
不过,当我尝试运行pip install pymssql时遇到了这个问题。

错误如下。

  Using cached pymssql-2.2.2.tar.gz (170 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pymssql
  Building wheel for pymssql (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
Your project path and someinfo about it.

Complete output (25 lines):
  setup.py: platform.system() => Darwin
  setup.py: platform.architecture() => ('64bit', '')
  setup.py: platform.libc_ver() => ('', '')
  setup.py: include_dirs => []
  setup.py: library_dirs => []
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-universal2-3.9
  creating build/lib.macosx-10.9-universal2-3.9/pymssql
  copying src/pymssql/__init__.py -> build/lib.macosx-10.9-universal2-3.9/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.macosx-10.9-universal2-3.9
  creating build/temp.macosx-10.9-universal2-3.9/src
  creating build/temp.macosx-10.9-universal2-3.9/src/pymssql
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/lakshayrohilla/SMS Project Files /cracs-backend/.venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/pymssql/_mssql.c -o build/temp.macosx-10.9-universal2-3.9/src/pymssql/_mssql.o -DMSDBLIB
  src/pymssql/_mssql.c:682:10: fatal error: 'sqlfront.h' file not found
  #include "sqlfront.h"
           ^~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  **ERROR: Failed building wheel for pymssql**
Failed to build pymssql
**ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects**

在尝试大量解决此问题的解决方案时,似乎对我有用。
我提供下面的代码来解决这个问题。

注意:根据您的系统更改路径。

1. brew install freetds
2. brew install openssl
3. export LDFLAGS="-L/opt/homebrew/Cellar/freetds/1.3.3/lib -L/opt/homebrew/Cellar/openssl@1.1/1.1.1l_1/lib"
4. export CFLAGS="-I/opt/homebrew/Cellar/freetds/1.3.3/include" 
5. pip install pymssql

只需运行上述命令,它应该可以解决您的问题,因为它对我有用。

运行以下命令解决了我的问题

$ brew install freetds openssl
$ echo 'export LDFLAGS="-L/opt/homebrew/opt/freetds/lib -L/opt/homebrew/opt/openssl@3/lib"' >> ~/.zshrc
$ echo 'export CFLAGS="-I/opt/homebrew/opt/freetds/include"' >> ~/.zshrc
$ echo 'export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"' >> ~/.zshrc
$ source ~/.zshrc
$ pip3 install pymssql

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM