【发布时间】:2015-07-18 12:57:15
【问题描述】:
我正在尝试在 CentOS 机器上安装 Python 的 pymssql,但它一直在我身上失败。
我已经安装了以下:
freetds-开发
python开发
这似乎是我在搜索中不断遇到的修复,但是我已经安装了这两个,但我仍然收到以下错误:
pip install pymssql
Collecting pymssql
/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79:
Using cached pymssql-2.1.1.tar.gz
Installing collected packages: pymssql
Running setup.py install for pymssql
Complete output from command /usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-oU7MKZ/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PE9Gxh-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() => ('Red Hat Enterprise Linux Server', '6.3', '*******')
setup.py: platform.libc_ver() => ('glibc', '2.3')
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 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/local/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -DMSDBLIB
_mssql.c:314:22: error: sqlfront.h: No such file or directory
In file included from _mssql.c:316:
cpp_helpers.h:34:19: error: sybdb.h: No such file or directory
_mssql.c:532: error: expected specifier-qualifier-list before ‘BYTE’
_mssql.c:683: error: expected specifier-qualifier-list before ‘DBPROCESS’
.............[Lots of errors removed from here]
:22123: error: ‘SYBVARBINARY’ undeclared (first use in this function)
_mssql.c:22135: error: ‘SYBVARCHAR’ undeclared (first use in this function)
_mssql.c: At top level:
_mssql.c:23607: error: expected ‘)’ before ‘val’
_mssql.c:23689: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__Pyx_PyInt_from_py_DBINT’
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-oU7MKZ/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PE9Gxh-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-oU7MKZ/pymssql
所以我在日志中看到了这个错误:
_mssql.c:314:22:错误:sqlfront.h:在 _mssql.c:316 包含的文件中没有这样的文件或目录:
搜索结果表明我需要安装 freetds-devel 和/或 python-devel 但我已经安装了。
我也注意到这一行:
setup.py:不使用捆绑的 FreeTDS
我是基于 Linux 的操作的新手,所以我不确定这是否意味着它根本不使用 FreeTDS,或者它只是使用我下载的版本而不是捆绑版本或其他什么?这是否表明我下载的 freetds-devel 可能没有正确使用?如果是这样,我怎样才能让 setup.py 使用我下载的 freetds-devel?
如果 freetds-devel 不是问题,那么我是否还缺少其他东西来安装 pymssql?
编辑:更多信息当我运行以下查找命令时:
sudo find / -name "sqlfront.h"
它抱怨的文件在这里找到:
/usr/include/freetds/sqlfront.h
难道只是我的 FreeTDS 安装搞砸了还是出了什么问题?
【问题讨论】:
标签: python centos pip freetds pymssql