简体   繁体   English

导入pymssql时出错

[英]Error importing pymssql

I am trying to import pymssql and I am getting this error (I think I have installed it correctly): 我正在尝试导入pymssql,并且出现此错误(我想我已经正确安装了):

Traceback (most recent call last):
File "sql.py", line 1, in <module>
    import pymssql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymssql.so, 2): Symbol not found: _dbversion
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymssql.so
  Expected in: dynamic lookup

How do I solve this? 我该如何解决?

The symbol was not found on import, possibly due to a linking problem at compilation when setup.py was run. 在导入时找不到该符号,可能是由于运行setup.py时编译时出现链接问题。

I ran into this particular issue because I was running 32-bit Python 2.7.12 on my OS X machine. 我遇到了这个特定问题,因为我在OS X机器上运行32位Python 2.7.12。 Doing the following resolved the issue for me: 执行以下操作可以为我解决此问题:

You need FreeTDS for the build to succeed, and if you don't build with the proper architecture, it is possible you will run into this error. 您需要FreeTDS才能使构建成功,如果您使用的体系结构不正确,则很可能会遇到此错误。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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