山西雁徐良 发表于 2023-9-14 12:03:49

如何在MacOS Sierra上安装pymssql

Command “/usr/bin/python -u -c “import setuptools,tokenize;file=’/private/tmp/pip-build-J1I0ox/pymssql/setup.py’;f=getattr(tokenize,‘open’,open)(file);code=f.read().replace(‘\r\n’,‘\n’);f.close();exec(compile(code,file,‘exec’))” install –record /tmp/pip-qmtdBW-record/install-record.txt –single-version-externally-managed –compile” failed with error code 1 in /private/tmp/pip-build-J1I0ox/pymssql/
我遇到了与这里显示的错误相同的错误。我试着按brew installfreetds跟随页面上的指示sudo -H pip install pymssql。
生成此错误代码:
                _mssql.c:18814:15: error: use of undeclared identifier 'DBVERSION_80'    __pyx_r = DBVERSION_80.         ^4 warnings and 1 error generated.error: command 'cc' failed with exit status 1----------------------------------------Command "/usr/bin/python -u -c "import setuptools,tokenize;__file__='/private/tmp/pip-build-J1I0ox/pymssql/setup.py';f=getattr(tokenize,'open',open)(__file__);code=f.read().replace('\r\n','\n');f.close();exec(compile(code,__file__,'exec'))" install --record /tmp/pip-qmtdBW-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-J1I0ox/pymssql/搜索这个错误把我带到了这个页面。我也跟着解决方案张贴,通过尝试。brew unlink freetds; brew installhomebrew/versions/freetds091和brew uninstall freetds; brew installhomebrew/versions/freetds091试图犯不同的错误sudo -H pip install pymssql:
_mssql.c:266:10: fatal error: 'sqlfront.h' file not found#include "sqlfront.h"         ^1 error generated.error: command 'cc' failed with exit status 1----------------------------------------Command "/usr/bin/python -u -c "import setuptools,tokenize;__file__='/private/var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-build-97A9sQ/pymssql/setup.py';f=getattr(tokenize,'open',open)(__file__);code=f.read().replace('\r\n','\n');f.close();exec(compile(code,__file__,'exec'))" install --record /var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-0nUZo4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_s/27xppw4j3yl78c9l4v1w3n9m0000gn/T/pip-build-97A9sQ/pymssql/因此,我放弃了尝试安装pyodbc,但仍有类似的错误: src/pyodbc.h:56:10: fatal error: 'sql.h' filenot found #include sql.h
任何帮助都会很棒。
                                                               
    解决方案:                                                               
                                                                链接终于解决了我的问题。这个命令序列对其他遇到这些问题的人有用。
brew uninstall --force freetdsbrew install freetds@0.91brew link --force freetds@0.91pip install pymssql
页: [1]
查看完整版本: 如何在MacOS Sierra上安装pymssql