在 Mac OS X Lion 上安装 pymssql 时出错

2023-12-29

我安装了 XCode 和 FreeTDS。我尝试连接到我的 SQL Server,它工作得很好。

现在我必须在 python 上开发一个与此 SQL Server 配合使用的应用程序,并且我正在尝试安装 pymysql,但是当我启动 sudo python setup.py 命令时出现此错误:

==> sudo python setup.py install
running install
running bdist_egg
running egg_info
writing pymssql.egg-info/PKG-INFO
writing top-level names to pymssql.egg-info/top_level.txt
writing dependency_links to pymssql.egg-info/dependency_links.txt
reading manifest file 'pymssql.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pymssql.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-intel/egg
running install_lib
running build_ext
skipping '_mssql.c' Cython extension (up-to-date)
building '_mssql' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/sw/include -Ifreetds/nix_64/include -I/opt/local/include -I/opt/local/include/freetds -I/opt/local/freetds/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mssql.c -o build/temp.macosx-10.7-intel-2.7/_mssql.o -DMSDBLIB
_mssql.c: In function ‘__pyx_f_6_mssql_15MSSQLConnection_convert_python_value’:
_mssql.c:7322: warning: implicit conversion shortens 64-bit value into a 32-bit value
_mssql.c: In function ‘__pyx_f_6_mssql_15MSSQLConnection_get_result’:
_mssql.c:9554: warning: implicit conversion shortens 64-bit value into a 32-bit value
_mssql.c:9566: warning: implicit conversion shortens 64-bit value into a 32-bit value
_mssql.c: In function ‘__pyx_pf_6_mssql_20MSSQLStoredProcedure_2bind’:
_mssql.c:11146: warning: implicit conversion shortens 64-bit value into a 32-bit value
llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.7-intel-2.7/_mssql.o -L/sw/lib -Lfreetds/nix_64/lib -L/opt/local/lib -L/opt/local/lib/freetds -L/opt/local/freetds/lib -lsybdb -lrt -o build/lib.macosx-10.7-intel-2.7/_mssql.so
ld: warning: directory not found for option '-L/sw/lib'
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/opt/local/lib/freetds'
ld: warning: directory not found for option '-L/opt/local/freetds/lib'
ld: library not found for -lrt
collect2: ld returned 1 exit status
ld: warning: directory not found for option '-L/sw/lib'
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/opt/local/lib/freetds'
ld: warning: directory not found for option '-L/opt/local/freetds/lib'
ld: library not found for -lrt
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//cc6eQsIN.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1

有什么帮助或线索吗?


不幸的是,pymssql 的 setup.py(从版本 pymssql-2.0.0b1-dev-20111019 开始)需要一些帮助才能在 OSX Lion 上正常工作。当前的 setup.py 尝试针对一些预构建的 Linux FreeTDS 库进行编译/链接,并且还尝试针对 OSX 上不存在的 librt 进行链接。此外,它仅显式查找来自 Fink 或 MacPorts 的 FreeTDS 库,因此,如果您在非标准位置安装了 Homebrew(如果使用 if)或 FreeTDS 本身,则编译器/链接器可能无法找到它。

我创建了 setup.py 的修复版本here http://code.google.com/r/dinkypumpkin-pymssql/source/browse/setup.py。它对我来说使用标准位置(/usr/local/{lib, include})的 FreeTDS Homebrew 版本运行得很好,但一如既往的 YMMV。如果您已将 FreeTDS 安装在其他位置,则可能需要进一步调整 setup.py。您通常可以忽略链接器发出的有关系统上可能不存在的丢失目录的警告:

ld:警告:找不到选项“-L/usr/local/lib/freetds”的目录

另请注意:您可能会为单一架构(可能是 x86_64)构建 FreeTDS。默认情况下,pymssl 将是多架构构建(假设您使用的是 Python 2.7.1 系统),因此即使使用修补后的 setup.py,您也会看到类似以下内容的链接器警告:

ld:警告:忽略文件 /usr/local/lib/libsybdb.dylib,该文件是为不受支持的文件格式构建的,该格式不是正在链接的体系结构(i386)

该警告仅表明 FreeTDS 库只有单一架构版本可供链接。您可以使用 ARCHFLAGS 进行仅限 x86_64 的构建来避免出现警告:

ARCHFLAGS="-arch x86_64" python setup.py install

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Mac OS X Lion 上安装 pymssql 时出错 的相关文章

随机推荐

  • C++中**是什么意思? [复制]

    这个问题在这里已经有答案了 例如 bool insertInFront IntElement head int data IntElement newElem new IntElement if newElem return false n
  • Google 通讯录 api (gdata) 同步低分辨率照片

    我正在使用 google 联系人 api gdata 在 google 联系人中设置联系人的照片 我正在使用 fiddler 我看到请求是根据Google 通讯录示例 https developers google com google a
  • Angular Spectator setInput 不适用于非字符串输入

    我已经成功地将我的项目转换为使用 Jest 代替 Karma Jasmine 并且我有很多测试运行得很好 我正在尝试使用 Spectator 5 2 1 进行一个非常简单的测试 但它不起作用 我正在尝试测试使用 mat table 呈现表格
  • Rails 路由的 API 版本控制

    我正在尝试像 Stripe 那样对我的 API 进行版本控制 下面给出的最新 API 版本是 2 api users返回 301 api v2 users api v1 users返回版本 1 的 200 个用户索引 api v3 user
  • 多条件IF语句

    我有一个包含多个条件的 if 语句 但我似乎无法正确执行 if ISSET SESSION status SESSION username qqqqq ISSET SESSION status SESSION company wwwwww
  • Kotlin 中通过反射获取 Enum 值

    您将如何用 Kotlin 重写以下 Java 代码 SuppressWarnings unchecked rawtypes static Object getEnumValue String enumClassName String enu
  • 如何将顶视图折叠成较小尺寸的视图?

    这个问题之前曾以过于宽泛和不清楚的方式提出过here https stackoverflow com q 47053822 878126 所以我使它更加具体 并提供了我所尝试的完整解释和代码 背景 我需要模仿谷歌日历在顶部有一个视图的方式
  • JavaScript 中的构造函数或对象继承

    我是 JavaScript 新手 本周开始学习 我已经完成了 CodeCademy 课程 实际上只是对象 1 2 部分 其余的很无聊 我以为我学会了构造函数的原型继承 但我已经开始观看了Douglas Crockford 高级 JavaSc
  • 在两个curl请求之间保存cookie

    我知道使用cURL我可以使用以下命令查看收到的 cookie 标头 curl head www google com 我知道我可以使用以下方法将标头添加到我的请求中 curl cookie Key Value www google com
  • Android 以编程方式重置出厂设置

    我尝试使用 RecoverySystem 类在 Android 中执行恢复出厂设置 但出现权限错误 但我无法覆盖这些错误 因为它们是系统权限 我想知道是否还有其他方法可以恢复出厂设置 第三方应用程序绝对可以做到这一点 在 2 2 设备 包括
  • 将 LUIS 对话框连接到表单对话框并映射正确的字段

    我正在开发一个可以预订航班的机器人 我正在使用最新版本的机器人框架 1 1 如建议 https stackoverflow com questions 36712912 mapping luis entities to dialog fie
  • 特征返回特征:在某些情况下有效,在其他情况下无效

    我需要实现一个返回的特征futures StreamExt trait 一般来说 这听起来很简单 并且有几个答案 例如这里 https stackoverflow com questions 60143046 how can a rust
  • 在小提琴图上绘制群图会更改 ylim 并截断小提琴

    import seaborn as sns import numpy as np for sample data import pandas as pd sample data np random seed 365 rows 60 data
  • 如何在Python中将字符串列表转换为字典[重复]

    这个问题在这里已经有答案了 我有一个字符串列表 我想转换成字典 我在抓取数据后得到了输出 Name Dr Mak Location India Delhi Name Dr Hus MD Location US NY 我想要如下输出 Name
  • CQRS-最终一致性

    我有以下场景 需要按照 CQRS 模式来实现 用户登录 用户输入一些保险详细信息 用户请求应用决定 用户查看决策结果 这看起来相当简单 但是我的问题是在步骤 3 和 4 之间 在步骤 3 中我发送了一个ApplyForDecision命令将
  • 来自 Spring Hateoas 的文档 HAL“_links”(带有招摇)? [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我想为我的客户开发团队记录一个 REST 服务 所以我添加了一些Links from Spring H
  • 将mat文件转换为pandas dataframe问题

    你好 我一直致力于将 matlab 矩阵良好地转换为 pandas 数据帧 我转换了它 但我有一行 其中有列表列表 这些列表通常是我的行 import pandas as pd import numpy as np from scipy i
  • Qi Symbols 性能慢?

    我想提出一个让我掉进兔子洞的话题 并提出了一个关于 气 符号 这一切都是在我研究新的野兽图书馆并阅读时开始的A 教程示例 http www boost org doc libs 1 66 0 libs beast example http
  • 如何更改标记图标?

    我想知道是否有办法改变那些用作标记的红色别针 如果有办法的话 该怎么做呢 您可以在地图视图中使用以下 3 种颜色图钉 MKPinAnnotationColorGreen MKPinAnnotationColorPurple MKPinAnn
  • 在 Mac OS X Lion 上安装 pymssql 时出错

    我安装了 XCode 和 FreeTDS 我尝试连接到我的 SQL Server 它工作得很好 现在我必须在 python 上开发一个与此 SQL Server 配合使用的应用程序 并且我正在尝试安装 pymysql 但是当我启动 sudo