在 OS X 上构建 pymssql

发布于 2024-11-16 05:53:37 字数 1050 浏览 3 评论 0原文

尝试在 Mac OS X 10.6.6 上构建任何版本的 pymssql。版本 1.0.2(稳定)和 1.9.909(主干)都可以构建并安装,但在导入时返回以下错误。有人在这个项目上取得过成功吗? (注意我正在使用 pyodbc 同时,但希望尽可能消除 ODBC 层

Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import pymssql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_mssql.pxd", line 10, in init pymssql (pymssql.c:8444)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pymssql-1.9.909_dev-py2.6-macosx-10.6-intel.egg/_mssql.so, 2): **Symbol not found: _dbadata**
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pymssql-1.9.909_dev-py2.6-macosx-10.6-intel.egg/_mssql.so
  **Expected in: flat namespace**
 in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pymssql-1.9.909_dev-py2.6-macosx-10.6-intel.egg/_mssql.so

Attempting to build any version of pymssql on Mac OS X 10.6.6. Both versions 1.0.2 (stable) and 1.9.909 (trunk) build and install, but return the following error on import. Has anyone had success with this project? (note I am using pyodbc in the meantime, but would like to eliminate the ODBC layer if possible)

Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import pymssql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_mssql.pxd", line 10, in init pymssql (pymssql.c:8444)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pymssql-1.9.909_dev-py2.6-macosx-10.6-intel.egg/_mssql.so, 2): **Symbol not found: _dbadata**
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pymssql-1.9.909_dev-py2.6-macosx-10.6-intel.egg/_mssql.so
  **Expected in: flat namespace**
 in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pymssql-1.9.909_dev-py2.6-macosx-10.6-intel.egg/_mssql.so

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡墨 2024-11-23 05:53:37

我为此编写的 fab (fabric) 脚本

import os
from fabric.api import local

def prep_dev_env():
    os.chdir('/tmp/')
    local('cvs -d:pserver:freetds.cvs.sourceforge.net:/cvsroot/freetds login')
    local('cvs -z3 -d:pserver:freetds.cvs.sourceforge.net:/cvsroot/freetds checkout -P freetds')
    os.chdir('/tmp/freetds/')
    local('sudo ./autogen.sh --with-tdsver=7.0')
    local('sudo make')
    local('sudo make install')
    os.chdir('/tmp/')
    #assumes macports is installed
    local('sudo port install mercurial')
    local('hg clone https://code.google.com/p/pymssql/')
    os.chdir('/tmp/pymssql/')
    local('python setup.py config')
    local('python setup.py build')
    local('python setup.py install')
    return

fab (fabric) script I wrote to do this

import os
from fabric.api import local

def prep_dev_env():
    os.chdir('/tmp/')
    local('cvs -d:pserver:freetds.cvs.sourceforge.net:/cvsroot/freetds login')
    local('cvs -z3 -d:pserver:freetds.cvs.sourceforge.net:/cvsroot/freetds checkout -P freetds')
    os.chdir('/tmp/freetds/')
    local('sudo ./autogen.sh --with-tdsver=7.0')
    local('sudo make')
    local('sudo make install')
    os.chdir('/tmp/')
    #assumes macports is installed
    local('sudo port install mercurial')
    local('hg clone https://code.google.com/p/pymssql/')
    os.chdir('/tmp/pymssql/')
    local('python setup.py config')
    local('python setup.py build')
    local('python setup.py install')
    return
紅太極 2024-11-23 05:53:37

让它与 tdsver 7.2 一起使用,请参阅此处

在我的虚拟环境中:

pip install cython >> ok
vim `locate Formula/freetds.rb`
#:s:7.1:8.0:g # Change version 7.1 to 8.0...
#:wq
cd /tmp
wget http://pypi.python.org/packages/source/p/pymssql/pymssql-1.0.2.tar.gz#md5=04dc4aa591acacbc8f183daeea21b690
tar -xzvf pymssql-1.0.2.tar.gz
cd pymssql-1.0.2
python setup.py config
python setup.py build
sudo python setup.py install

最后, 成功!

Got this to work with tdsver 7.2, see here

In the context of my virtual environment:

pip install cython >> ok
vim `locate Formula/freetds.rb`
#:s:7.1:8.0:g # Change version 7.1 to 8.0...
#:wq
cd /tmp
wget http://pypi.python.org/packages/source/p/pymssql/pymssql-1.0.2.tar.gz#md5=04dc4aa591acacbc8f183daeea21b690
tar -xzvf pymssql-1.0.2.tar.gz
cd pymssql-1.0.2
python setup.py config
python setup.py build
sudo python setup.py install

Finally, success!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文