0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【macOS12.3.1】pip install pyodbcで”src/pyodbc.h:56:10: fatal error: 'sql.h' file not found”エラー対応備忘録

Last updated at Posted at 2022-04-05

現象

pip install pyodbcで以下のエラーでインストールできず.

zsh
$ pip install pyodbc
Collecting pyodbc
  Using cached pyodbc-4.0.32.tar.gz (280 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pyodbc, since package 'wheel' is not installed.
Installing collected packages: pyodbc
  Running setup.py install for pyodbc ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pyodbc did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.macosx-12.3-x86_64-3.10
      creating build/temp.macosx-12.3-x86_64-3.10/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DPYODBC_VERSION=4.0.32 -UMAC_OS_X_VERSION_10_7 -I/usr/local/include -I/Users/takasukaoru/python_project/corpdb/corpdb/.venv/include -I/Users/takasukaoru/.pyenv/versions/3.10.1/include/python3.10 -c src/buffer.cpp -o build/temp.macosx-12.3-x86_64-3.10/src/buffer.o -Wno-write-strings -Wno-deprecated-declarations
      In file included from src/buffer.cpp:12:
      src/pyodbc.h:56:10: fatal error: 'sql.h' file not found
      #include <sql.h>
               ^~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyodbc

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

"sql.h"が見つかりません。sql.hとは・・・。

対処法

色々謎だったが、ここがヒットしたので、この対処法を試す.

zsh
brew install unixodbc

これで無事pip install pyodbcが通った.
理由は調査中.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?