• 安装pymssql,出现下面情况
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
[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
1
sudo yum install freetds-devel
SQLServer和Sybase使用的协议是TDS协议,linux中使用freetds连接SQLServer.