RHEL 6.5 上的 pymssql - 使用 /opt/app/freetds 中的源代码安装 freetds

Posted

技术标签:

【中文标题】RHEL 6.5 上的 pymssql - 使用 /opt/app/freetds 中的源代码安装 freetds【英文标题】:pymssql on RHEL 6.5 - freetds installed using source in /opt/app/freetds 【发布时间】:2015-04-13 21:52:48 【问题描述】:

万事如意,

我正在尝试在 RHEL 6.5 上安装 pymssql。

我从他们的网站下载了 freetds 源并安装了它。

cd /opt/app
tar xfz /Prerequisites/freetds-stable.tgz
cd /opt/app/freetds-0.91
./configure --prefix=/opt/app/freetds
make
make install

在此之后,我尝试使用此命令安装 pymssql,但它失败了。

显然,它无法找到应该在 /opt/app/freetds/include 和 /opt/app/freetds/lib 文件夹中的必要头文件和库。

我能做些什么来解决这个问题?

请指导。

[gdd@svr /Prerequisites]$pip install pymssql-2.1.1.tar.gz --no-index --find-links /Prerequisites
Ignoring indexes: https://pypi.python.org/simple
Processing ./pymssql-2.1.1.tar.gz
    setup.py: platform.system() => 'Linux'
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.linux_distribution() => ('Red Hat Enterprise Linux Server', '6.5', 'Santiago')
    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']
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() => ('Red Hat Enterprise Linux Server', '6.5', 'Santiago')
    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 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/opt/app/Python2.7.9/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -DMSDBLIB
    gcc -pthread -shared build/temp.linux-x86_64-2.7/_mssql.o -L/usr/local/lib -L/opt/app/Python2.7.9/lib -lsybdb -lrt -lpython2.7 -o build/lib.linux-x86_64-2.7/_mssql.so
    /usr/bin/ld: cannot find -lsybdb
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    Complete output from command /opt/app/Python2.7.9/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-nO5nuo-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tEZz4T-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.5', 'Santiago')


    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 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/opt/app/Python2.7.9/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -DMSDBLIB


    creating build/lib.linux-x86_64-2.7


    gcc -pthread -shared build/temp.linux-x86_64-2.7/_mssql.o -L/usr/local/lib -L/opt/app/Python2.7.9/lib -lsybdb -lrt -lpython2.7 -o build/lib.linux-x86_64-2.7/_mssql.so


    /usr/bin/ld: cannot find -lsybdb


    collect2: ld returned 1 exit status


    error: command 'gcc' failed with exit status 1


    ----------------------------------------
    Command "/opt/app/Python2.7.9/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-nO5nuo-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tEZz4T-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-nO5nuo-build

请指导。

【问题讨论】:

【参考方案1】:

感谢 runciter @ IRC #python 的提示。 . .我能够如下解决这个问题

export CFLAGS='-I/opt/app/freetds/include' 
export LDFLAGS='-L/opt/app/freetds/lib'
pip install /Prerequisites/pymssql-2.1.1.tar.gz --no-index --find-links /Prerequisites

【讨论】:

以上是关于RHEL 6.5 上的 pymssql - 使用 /opt/app/freetds 中的源代码安装 freetds的主要内容,如果未能解决你的问题,请参考以下文章

在 OS X 上构建 pymssql

RHEL 6.5 静默安装 oracle 11.2.4

1rhel 6.5 系统准备

RHEL 6.5忘记root密码处理方法

RHEL 6.5 安装ORACEL11gR2

RHEL 6.5 PXE 安装调试