简体   繁体   English

在Mac OS 10.6上安装/构建pymssql(python 2.6)

[英]installing/building pymssql on Mac OS 10.6 (python 2.6)

As instructed in the README and here http://code.google.com/p/pymssql/wiki/Compilation , I've installed Cython (v0.14.1), FreeTDS (v0.82 using MacPorts), and I already have XCode installed with gcc. 按照自述文件和http://code.google.com/p/pymssql/wiki/Compilation中的说明 ,我安装了Cython(v0.14.1),FreeTDS(使用MacPorts的v0.82),我已经安装了XCode用gcc安装。

I've run into build errors during python setup.py install : a lot of undeclared name not builtin: with things like strlen , PyMem_Malloc , PyMem_Free , PY_LONG_LONG as well as a few ___ is deprecated, use 'cpython' 我在python setup.py install期间遇到了构建错误:很多undeclared name not builtin:strlenPyMem_MallocPyMem_FreePY_LONG_LONG以及一些___ is deprecated, use 'cpython'

Google found me this thread http://groups.google.com/group/cython-users/browse_thread/thread/468bb80480ede699/dc8267a4274c2413 where someone addresses the first error (changed to from libc.string cimport strlen, strcpy from from stdlib cimport strlen, strcpy .) 谷歌找到了我这个帖子http://groups.google.com/group/cython-users/browse_thread/thread/468bb80480ede699/dc8267a4274c2413 ,其中有人解决了第一个错误(改为from libc.string cimport strlen, strcpy from stdlib cimport strlen, strcpy 。)

Now I'm getting: _mssql.pyx:650:34: Cannot convert Python object to 'const_char *' 现在我得到: _mssql.pyx:650:34: Cannot convert Python object to 'const_char *'

Here is the file that these issues are coming from http://code.google.com/p/pymssql/source/browse/tags/1.9.908/_mssql.pyx 以下是这些问题来自http://code.google.com/p/pymssql/source/browse/tags/1.9.908/_mssql.pyx的文件

My question: 我的问题:

If I have not prepared my system correctly for pymssql what have I done wrong? 如果我没有为pymssql正确准备我的系统我做错了什么?

or 要么

If the _mssql.pyx file is using deprecated imports how do I fix them? 如果_mssql.pyx文件正在使用不推荐的导入,我该如何修复它们?

I have pip installed so I obtained Cython using: 我安装了pip所以我使用以下方法获得了Cython:

pip install Cython

I went to www.freetds.org and got the cvs command to download the latest source (User Guide then "What to build: Packages, Tarballs, and the CVS repository"). 我去了www.freetds.org并获得了cvs命令来下载最新的源代码(用户指南,然后是“构建什么:包,Tarballs和CVS存储库”)。 To build this, ignore the instructions on the web site and look at the file INSTALL.CVS in the root of the repository you just downloaded. 要构建它,请忽略网站上的说明,并查看刚下载的存储库根目录中的文件INSTALL.CVS。 When you run ./autogen.sh use: 当你运行./autogen.sh时使用:

./autogen.sh --with-tdsver=7.0

the autogen.sh will create a configure script then the configure script will get the switch. autogen.sh将创建一个configure脚本,然后configure脚本将获得该开关。 You need to be using 7.0 for python to work with TDS and MS SQL. 你需要使用7.0 for python来使用TDS和MS SQL。 After the autogen.sh you do a 'make' then a 'sudo make install'. 在autogen.sh之后你做'make'然后'sudo make install'。

Now you need the pymssql tarball. 现在你需要pymssql tarball。 Unpack it and run: 打开包装并运行:

python setup.py config
python setup.py build
sudo python setup.py install

that should do it. 应该这样做。

Have you tried building 1.9.909 from the trunk? 你试过从行李箱里建造1.9.909吗? It builds cleanly for me, where .908 did not. 它为我打造干净利落,而.908没有。

Unfortunately I get import errors even though there is a successful build and install: Building pymssql on OS X 不幸的是,即使成功构建和安装,我也会遇到导入错误: 在OS X上构建pymssql

This fork compiles like a charm: 这个fork编译成一个魅力:

https://github.com/blackbass1988/pymssql-macos-lion https://github.com/blackbass1988/pymssql-macos-lion

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

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