天天看點

python 安裝mssql擴充

  linux下連接配接SQL SERVER 可是一件非常痛苦的事情,python下有pymssql擴充庫去連接配接,但是安裝确實比較麻煩和痛苦

開始很自然的想到 easy_install pymssql 出現 Searching for pymssql Reading https://pypi.python.org/simple/pymssql/ Reading http://code.google.com/p/pymssql/ Reading http://code.google.com/p/pymssql/downloads/list Reading http://pymssql.sourceforge.net Download error on http://pymssql.sourceforge.net: timed out -- Some packages may not be found! Reading http://sourceforge.net/project/showfiles.php?group_id=40059&package_id=32202 Best match: pymssql 2.0.0b1-dev-20130403 Downloading http://pymssql.googlecode.com/files/pymssql-2.0.0b1-dev-20130403.tar.gz Processing pymssql-2.0.0b1-dev-20130403.tar.gz Writing /tmp/easy_install-Q0iuH6/pymssql-2.0.0b1-dev-20130403/setup.cfg Running pymssql-2.0.0b1-dev-20130403/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Q0iuH6/pymssql-2.0.0b1-dev-20130403/egg-dist-tmp-iZ2UMu creating tmp creating tmp/easy_install-Q0iuH6 creating tmp/easy_install-Q0iuH6/pymssql-2.0.0b1-dev-20130403 creating tmp/easy_install-Q0iuH6/pymssql-2.0.0b1-dev-20130403/temp cc -c /tmp/easy_install-Q0iuH6/pymssql-2.0.0b1-dev-20130403/temp/clock_gettime8KzG4j.c -o tmp/easy_install-Q0iuH6/pymssql-2.0.0b1-dev-20130403/temp/clock_gettime8KzG4j.o cc tmp/easy_install-Q0iuH6/pymssql-2.0.0b1-dev-20130403/temp/clock_gettime8KzG4j.o -lrt -o a.out warning: no files found matching 'win32/freetds.zip' /usr/bin/ld: cannot find -lct collect2: ld returned 1 exit status error: Setup script exited with error: command 'gcc' failed with exit status 1 很自然以為系統沒有安裝python-devel yum install python-devel 顯示已經安裝 然後從pypi下載下傳軟體包安裝 python setup.py build running build running build_ext skipping '_mssql.c' Cython extension (up-to-date) building '_mssql' extension gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/root/pymssql-2.0.0b1-dev-20130403/freetds/nix_64/include -I/usr/include/python2.6 -c _mssql.c -o build/temp.linux-x86_64-2.6/_mssql.o -Wno-parentheses-equality -DMSDBLIB gcc -pthread -shared build/temp.linux-x86_64-2.6/_mssql.o -L/root/pymssql-2.0.0b1-dev-20130403/freetds/nix_64/lib -L/usr/lib64 -lsybdb -lct -lrt -lpython2.6 -o build/lib.linux-x86_64-2.6/_mssql.so /usr/bin/ld: cannot find -lct collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 還是gcc 不過上面說skipping '_mssql.c' Cython extension (up-to-date) 然後檢視build/temp.linux-x86_64-2.6/目錄空空 說明庫沒有編譯上 google了一下發現是freetds的問題 官方位址:http://www.freetds.org/

下載下傳安裝 過程如下: tar xvf freetds-stable.tgz cd freetds-0.91/ ./configure  --with-tdsver=8.0 --enable-msdblib make && make install 解決問題