简体   繁体   中英

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.

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?

I have pip installed so I obtained Cython using:

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"). 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:

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

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:

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? 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

This fork compiles like a charm:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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