在 Mac OS 10.6 (python 2.6) 上安装/构建 pymssql
按照自述文件和此处 http://code.google.com/p/pymssql/ 中的说明wiki/Compilation,我已经安装了 Cython (v0.14.1)、FreeTDS (v0.82 使用 MacPorts),并且我已经使用 gcc 安装了 XCode。
我在 python setup.py install 期间遇到了构建错误: 很多未声明的名称不是内置的:
,例如strlen
、PyMem_Malloc
、PyMem_Free
、PY_LONG_LONG< /code> 以及一些
___ 已弃用,请使用 'cpython'
Google 找到了我这个线程 http://groups.google.com/group/cython-users/browse_thread/thread/468bb80480ede699/dc8267a4274c2413 有人解决了第一个错误(更改为 < code>from libc.string cimport strlen, strcpy from from stdlib cimport strlen, strcpy
.)
现在我得到: _mssql.pyx:650:34: Cannot conversion Python对象为“const_char *”
以下是这些问题来自的文件http://code.google.com/p/pymssql/source/browse/tags/1.9.908/_mssql.pyx
我的问题:
如果我还没有准备好我的系统正确地执行 pymssql
我做错了什么?
或者
如果 _mssql.pyx
文件使用已弃用的导入,我该如何修复它们?
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.
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'
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
.)
Now I'm getting: _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
My question:
If I have not prepared my system correctly for pymssql
what have I done wrong?
or
If the _mssql.pyx
file is using deprecated imports how do I fix them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个分支编译起来就像一个魅力:
https://github.com/blackbass1988/pymssql-macos-lion< /a>
This fork compiles like a charm:
https://github.com/blackbass1988/pymssql-macos-lion
您是否尝试过从主干构建 1.9.909 ?它对我来说构建得很干净,而 .908 则不然。
不幸的是,即使构建和安装成功,我也会遇到导入错误:在 OS X 上构建 pymssql
Have you tried building 1.9.909 from the trunk? It builds cleanly for me, where .908 did not.
Unfortunately I get import errors even though there is a successful build and install: Building pymssql on OS X
我已经安装了 pip,所以我使用以下方式获得了 Cython:
我访问 www.freetds.org 并使用 cvs 命令下载最新的源代码(用户指南,然后是“构建内容:包、Tarball 和 CVS 存储库”)。要构建它,请忽略网站上的说明并查看刚刚下载的存储库根目录中的 INSTALL.CVS 文件。当您运行 ./autogen.sh 时,使用:
autogen.sh 将创建一个配置脚本,然后该配置脚本将获取开关。您需要使用 7.0 for python 才能使用 TDS 和 MS SQL。在 autogen.sh 之后,您执行“make”,然后执行“sudo make install”。
现在您需要 pymssql tarball。解压并运行:
应该可以了。
I have pip installed so I obtained Cython using:
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"). 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. When you run ./autogen.sh use:
the autogen.sh will create a configure script then the configure script will get the switch. You need to be using 7.0 for python to work with TDS and MS SQL. After the autogen.sh you do a 'make' then a 'sudo make install'.
Now you need the pymssql tarball. Unpack it and run:
that should do it.