• 安装pymssql,出现下面情况
[wyq@localhost ~]$ sudo pip install pymssql
Downloading/unpacking pymssql
  Downloading pymssql-2.1.0.tar.bz2 (1.9MB):   0%  8.2kB
  Downloading pymssql-2.1.0.tar.bz2 (1.9MB): 1.9MB downloaded
  Running setup.py egg_info for package pymssql
    setup.py: platform.system() => 'Linux'
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.linux_distribution() => ('Fedora', '20', 'Heisenbug')
    setup.py: platform.libc_ver() => ('glibc', '2.2.5')
    setup.py: Not using bundled FreeTDS
    setup.py: include_dirs = ['/usr/local/include']
    setup.py: library_dirs = ['/usr/local/lib']
    
    warning: no files found matching 'pymssql_version.py'
    warning: no files found matching 'win32/freetds.zip'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: pymssql
  Running setup.py install for pymssql
    setup.py: platform.system() => 'Linux'
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.linux_distribution() => ('Fedora', '20', 'Heisenbug')
    setup.py: platform.libc_ver() => ('glibc', '2.2.5')
    setup.py: Not using bundled FreeTDS
    setup.py: include_dirs = ['/usr/local/include']
    setup.py: library_dirs = ['/usr/local/lib']
    building '_mssql' extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -I/usr/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -DMSDBLIB
    _mssql.c:346:22: 致命错误:sqlfront.h:没有那个文件或目录
     #include "sqlfront.h"
                          ^
    编译中断。
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/pymssql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-K_4vEY-record/install-record.txt --single-version-externally-managed:
    setup.py: platform.system() => 'Linux'

setup.py: platform.architecture() => ('64bit', 'ELF')

setup.py: platform.linux_distribution() => ('Fedora', '20', 'Heisenbug')

setup.py: platform.libc_ver() => ('glibc', '2.2.5')

setup.py: Not using bundled FreeTDS

setup.py: include_dirs = ['/usr/local/include']

setup.py: library_dirs = ['/usr/local/lib']

running install

running build

running build_ext

building '_mssql' extension

creating build

creating build/temp.linux-x86_64-2.7

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -I/usr/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -DMSDBLIB

_mssql.c:346:22: 致命错误:sqlfront.h:没有那个文件或目录

 #include "sqlfront.h"

                      ^

编译中断。

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/pymssql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-K_4vEY-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/pymssql
Traceback (most recent call last):
  File "/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 147, in main
    return command.main(args[1:], options)
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 169, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 21: ordinal not in range(128)
  • 需要安装freetds
sudo yum install freetds-devel
SQLServer和Sybase使用的协议是TDS协议,linux中使用freetds连接SQLServer.