热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在centos7中安装pymssql时出错

如何解决《在centos7中安装pymssql时出错》经验,为你挑选了2个好方法。

我在虚拟机中安装pymssql时遇到了问题(Centos 7)

我有python安装版本2.7.6

用于安装pymssql的命令,

pip intall pymssql

错误信息;

[root@dpitstsvr013 magendran]# pip install pymssql
Downloading/unpacking pymssql
  Downloading pymssql-2.1.1.tar.gz (2.4MB): 2.4MB downloaded
  Running setup.py (path:/tmp/pip_build_root/pymssql/setup.py) egg_info for package pymssql
    setup.py: platform.system() => 'Linux'
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.linux_distribution() => ('CentOS Linux', '7.0.1406', 'Core')
    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']

    Installed /tmp/pip_build_root/pymssql/setuptools_git-1.1-py2.7.egg

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.0.1406', 'Core')
    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:314:22: fatal error: sqlfront.h: No such file or directory
     #include "sqlfront.h"
                          ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-t3ztti-record/install-record.txt --single-version-externally-managed --compile:
    setup.py: platform.system() => 'Linux'

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

setup.py: platform.linux_distribution() => ('CentOS Linux', '7.0.1406', 'Core')

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:314:22: fatal error: sqlfront.h: No such file or directory

 #include "sqlfront.h"

                      ^

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-t3ztti-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/pymssql
Storing debug log for failure in /root/.pip/pip.log
[root@dpitstsvr013 magendran]# 

如果你有,请你提供一些解决方案,否则如果你能用其他方式在centos7中安装pymssql会有所帮助



1> Mark R...:

您需要安装freetds-devel(yum install freetds-devel),最有可能在EPEL中使用.



2> Ajay Gautam..:

文件sqlfront.h由freetds-devel提供.确保已安装

yum install freetds-devel

现在......验证文件是否存在.对于CentOS Linux版本7.1.1503,这是在这里:

ls -l /usr/include/sqlfront.h

找到后,设置C_INCLUDE_PATH,以便pip/gcc可以找到它:

export C_INCLUDE_PATH=/usr/include

现在重新运行pip ...


推荐阅读
author-avatar
乐韵答题
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有