When running pip install pyodbc
, I get
In file included from .../build/pyodbc/src/buffer.cpp:12: .../build/pyodbc/src/pyodbc.h:52:10: fatal error: 'sql.h' file not found #include <sql.h> ^ 1 error generated. error: command 'cc' failed with exit status 1
It seems that Mavericks has no sql.h under /usr/include
Did anyone manage to install pyodbc? Is there a known workaround?
Does Pyodbc work on Mac? pyodbc is an open source Python module that makes accessing ODBC databases simple. It implements the DB API 2.0 specification but is packed with even more Pythonic convenience. Precompiled binary wheels are provided for most Python versions on Windows and macOS.
You can use Homebrew to install unixodbc, then pyodbc via pip in the usual fashion.
brew install unixodbc && pip install pyodbc
This works for me on Mavericks.
As you noticed OSX Mavericks dropped sql headers that are required for PyODBC compilation. Following these steps allowed me to install PyODBC:
pip install --no-install pyodbc
cd [VIRTUAL_ENV]/build/pyodbc
python setup.py build_ext --include-dirs=[LIBIODBC_SOURCES]/include/
Run pip install --no-download pyodbc
:
Installing collected packages: pyodbc Running setup.py install for pyodbc warning: no files found matching 'tests/*' Successfully installed pyodbc Cleaning up...
I could as well copy the files under [libiodbc_sources]/include/
to my /usr/include
and just run pip install pyodbc
, but I didn't want to add files manually to system folders.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With