您是否在Mac OS X Sierra(10.12)上安装了pyodbc?

问题描述:

我尝试在mac os x sierra上安装pyodbc。我通过brew安装了python 2和3,并使用virtualenv隔离了所需的pacakges等。 首先,我尝试使用pip安装失败,然后执行以下命令:https://github.com/lionheart/django-pyodbc/wiki/Mac-setup-to-connect-to-a-MS-SQL-Server,除了实际的pyodbc安装外,它似乎进展顺利。您是否在Mac OS X Sierra(10.12)上安装了pyodbc?

虽然我有XCode和所有使用brew的工具,但我曾遇到库似乎与Apple工具链一样的问题。具体来说,我得到这个缺少sql.h消息:

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 

有什么奇怪的这一切是使用brew install unixodbc后,我发现我有sql.h/usr/local/Cellar/unixodbc/2.3.4/include/和文件中有符号链接到/usr/local/include/它只是没有按” t似乎被设置脚本以某种方式获取。

有没有人找到正确的方法来解决这个问题?

升级到Sierra并更新Xcode(并运行它以接受许可证)后,这些工具实际上并未完全准备好使用。 我不得不重新运行xcode-select --install,它下载了更多,然后它能够​​包含由于brew的unixodbc确实已经存在的头文件。