[root@host ~]# pip install pymssql
...
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-3.4
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/opt/software/python3/include/python3.4m -c _mssql.c -o build/temp.linux-x86_64-3.4/_mssql.o -DMSDBLIB
_mssql.c:266:22: fatal error: sqlfront.h: No such file or directory
#include "sqlfront.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/opt/software/python3/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-u1xa9z99/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e4st_n_f-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-u1xa9z99/pymssql
解决:
export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1
[root@host ~]# export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1
[root@host-10-134-236-125 freetds-0.91]# pip install pymssql
You are using pip version 6.0.8, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pymssql
Using cached https://files.pythonhosted.org/packages/4c/c8/5ad36d8d3c304ab4f310c89d0593ab7b6229568dd8e9cde927311b2f0c00/pymssql-2.1.3.tar.gz
setup.py: platform.system() => 'Linux'
setup.py: platform.architecture() => ('64bit', 'ELF')
setup.py: platform.linux_distribution() => ('CentOS Linux', '7.3.1611', 'Core')
setup.py: platform.libc_ver() => ('glibc', '2.2.5')
setup.py: Using bundled FreeTDS in /tmp/pip-build-c867urdm/pymssql/freetds/nix_64
setup.py: include_dirs = ['/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/include', '/usr/local/include']
setup.py: library_dirs = ['/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/lib', '/usr/local/lib']
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() => ('CentOS Linux', '7.3.1611', 'Core')
setup.py: platform.libc_ver() => ('glibc', '2.2.5')
setup.py: Using bundled FreeTDS in /tmp/pip-build-c867urdm/pymssql/freetds/nix_64
setup.py: include_dirs = ['/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/include', '/usr/local/include']
setup.py: library_dirs = ['/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/lib', '/usr/local/lib']
building '_mssql' extension
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/include -I/usr/local/include -I/opt/software/python3/include/python3.4m -c _mssql.c -o build/temp.linux-x86_64-3.4/_mssql.o -DMSDBLIB
gcc -pthread -shared build/temp.linux-x86_64-3.4/_mssql.o -L/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/lib -L/usr/local/lib -L/opt/software/python3/lib -lsybdb -lrt -lpython3.4m -o build/lib.linux-x86_64-3.4/_mssql.cpython-34m.so
building 'pymssql' extension
gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/include -I/usr/local/include -I/opt/software/python3/include/python3.4m -c pymssql.c -o build/temp.linux-x86_64-3.4/pymssql.o -DMSDBLIB
gcc -pthread -shared build/temp.linux-x86_64-3.4/pymssql.o -L/tmp/pip-build-c867urdm/pymssql/freetds/nix_64/lib -L/usr/local/lib -L/opt/software/python3/lib -lsybdb -lrt -lpython3.4m -o build/lib.linux-x86_64-3.4/pymssql.cpython-34m.so
Successfully installed pymssql-2.1.3
[root@host ~]#