bin*_*nza 11 python sql sql-server macos 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/
Run Code Online (Sandbox Code Playgroud)
我遇到与此处显示的相同的错误.我试图遵循该网页上的说明brew install freetds之后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/
Run Code Online (Sandbox Code Playgroud)
搜索此错误会将我带到此页面.我通过尝试两者来跟踪在那里发布的解决方案, brew unlink freetds; brew install homebrew/versions/freetds091并 brew uninstall freetds; brew install homebrew/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/
Run Code Online (Sandbox Code Playgroud)
所以然后我放弃并尝试安装pyodbc,但我仍然得到类似的错误: src/pyodbc.h:56:10: fatal error: 'sql.h' file not found
#include sql.h
对此的任何帮助都会很棒.
bin*_*nza 36
这个链接最终解决了我的问题.对于其他任何有这些问题的人来说,这一系列命令对我有用.
brew uninstall --force freetds
brew install freetds@0.91
brew link --force freetds@0.91
pip install pymssql
Run Code Online (Sandbox Code Playgroud)
McF*_*izz 12
截至 2021 年 2 月
我无法再安装 freetds@0.91,因为 homebrew 没有它可用。freetds的当前版本是1.2.18,brew link --force freetds似乎没有改变任何东西。
根本问题'sqlfront.h' file not found是由于 freetds 文件在安装过程中未正确链接所致。我们可以通过这样做来解决这个问题
export LDFLAGS="-L/opt/homebrew/opt/freetds/lib"
export CPPFLAGS="-I/opt/homebrew/opt/freetds/include"
pip install pymssql
Run Code Online (Sandbox Code Playgroud)
homebrew 在您的系统上安装 freetds 的位置/opt/homebrew/opt/freetds(我在 Apple Silicon 上),对您来说可能有所不同。如果您使用英特尔,您的可能看起来像这样/usr/local/opt/freetds。
要准确查找 homebrew 在您的系统上安装 freetds (或任何与此相关的程序)的位置,您可以执行以下操作
brew --prefix freetds
Run Code Online (Sandbox Code Playgroud)
这应该返回类似/opt/homebrew/opt/freetdsor的内容/opt/homebrew/opt/freetds@1.2.18。您可以忽略任何版本号并附加/lib和/include来获取您需要的路径。
这是一个需要记住的方便技巧,因为它适用于通过自制程序安装依赖项的许多其他安装问题。
| 归档时间: |
|
| 查看次数: |
4556 次 |
| 最近记录: |