简体   繁体   中英

Have you installed pyodbc on Mac OS X Sierra (10.12)?

I tried installing pyodbc on mac os X sierra. I installed both python 2 and 3 via brew, and use virtualenv to isolate required pacakges etc. First I tried installing with pip, which failed, then by following: https://github.com/lionheart/django-pyodbc/wiki/Mac-setup-to-connect-to-a-MS-SQL-Server , which seemed to be going well, except for the actual pyodbc installation.

Though I have XCode and the tools, all working with brew, I've had issues with libraries that seem to be expected as part of Apple's toolchain. Specifically, I'm getting this missing sql.h message:

clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPYODBC_VERSION=3.0.10 -DPYODBC_UNICODE_WIDTH=2 -UMAC_OS_X_VERSION_10_7 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c /Users/daniellamblin/pyodbc-3.0.10/src/buffer.cpp -o build/temp.macosx-10.11-x86_64-2.7/Users/daniellamblin/pyodbc-3.0.10/src/buffer.o -Wno-write-strings -Wno-deprecated-declarations
In file included from /Users/daniellamblin/pyodbc-3.0.10/src/buffer.cpp:12:
/Users/daniellamblin/pyodbc-3.0.10/src/pyodbc.h:52:10: fatal error: 'sql.h' file
      not found
#include <sql.h>
         ^
1 error generated.
error: command 'clang' failed with exit status 1

What's odd about all this is that after using brew install unixodbc I found that I have sql.h in /usr/local/Cellar/unixodbc/2.3.4/include/ and that the files in there are symlinked into /usr/local/include/ it just doesn't seem to be getting picked up by the setup script somehow.

Has anyone found the right way to work around this?

After upgrading to Sierra and updating Xcode (and running it to accept the license) the tools aren't actually fully ready to use. I had to just rerun xcode-select --install which downloaded more and then it was able to include the headers that were indeed already there due to brew's unixodbc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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