安装pymssql报错

简介:

  pip install pymssql==2.1.3  安装时报错如下:

 

    Running setup.py install for pymssql ... error
    ERROR: Command errored out with exit status 1:
     command: /python/opsmind_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rqij1dtx/pymssql_dad898b10fc14c5da9049a1693190425/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rqij1dtx/pymssql_dad898b10fc14c5da9049a1693190425/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-g759t7db/install-record.txt --single-version-externally-managed --compile --install-headers /python/opsmind_env/include/site/python3.6/pymssql
         cwd: /tmp/pip-install-rqij1dtx/pymssql_dad898b10fc14c5da9049a1693190425/
    Complete output (21 lines):
    /python/opsmind_env/lib/python3.6/site-packages/setuptools/dist.py:42: DistDeprecationWarning: Do not call this function
      warnings.warn("Do not call this function", DistDeprecationWarning)
    setup.py: platform.system() => 'Linux'
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.linux_distribution() => ('CentOS Linux', '7.8.2003', 'Core')
    setup.py: platform.libc_ver() => ('glibc', '2.17')
    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-3.6
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/python/opsmind_env/include -I/usr/local/python3/include/python3.6m -c _mssql.c -o build/temp.linux-x86_64-3.6/_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
    ----------------------------------------
ERROR: Command errored out with exit status 1: /python/opsmind_env/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rqij1dtx/pymssql_dad898b10fc14c5da9049a1693190425/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rqij1dtx/pymssql_dad898b10fc14c5da9049a1693190425/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-g759t7db/install-record.txt --single-version-externally-managed --compile --install-headers /python/opsmind_env/include/site/python3.6/pymssql Check the logs for full command output.

 

  解决方法:

  export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1

 

posted @ 2021-03-16 16:22  龙虚度  阅读(190)  评论(0编辑  收藏  举报