Python-无法打开lib'libtdsodbc.so':找不到文件 [英] Python - Can't open lib 'libtdsodbc.so' : file not found

查看:131
本文介绍了Python-无法打开lib'libtdsodbc.so':找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于此问题的任何帮助,我们深表感谢.

Any help with this issue is much appreciated.

目标:使用FreeTDS将Django连接到MSSQL服务器.我正在使用Debian x64盒.

Goal: Connect Django to MSSQL server using FreeTDS. I'm using a Debian x64 box.

问题:尝试建立连接时,我得到以下信息.

Problem: When trying to make a connection I get the following.

('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'libtdsodbc.so' : file not found (0) (SQLDriverConnect)")

我的/etc/odbcinst.ini 的配置如下

[FreeTDS]
Description = FreeTDS
driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so

的文件存在并且具有777的访问权限以进行测试.

The files do exist and have 777 access for testing.

连接字符串就像

cnxn = pyodbc.connect(
        'DRIVER={FreeTDS};SERVER=' + server + ';PORT=1443;DATABASE=' + database + ';UID=' + username + ';PWD=' + password)
    cursor = cnxn.cursor()

我的odbcinst -j读取(因为添加了符号链接)

My odbcinst -j reads (since adding symlink)

unixODBC 2.3.1
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

推荐答案

如果还有其他人遇到此障碍,请查看此博客文章.

If anyone else runs into this hurdle, check out this blog post.

https://emacstragic.net/2017/11/06/mssql-odbc-client-on-debian-9-stretch/

从本质上讲,我必须针对特定的libssl版本才能使其正常工作.

Essentially, I had to target a specific libssl version for it to work.

查看我发现的已安装版本:

Looking at the installed versions i found:

ldd /opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.1 | grep 'not found'
libcrypto.so.1.0.0 => not found
libssl.so.1.0.0 => not found

并手动安装先前版本可解决此问题

and manually installing a previous version fixed the issue

wget "http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb"
sudo apt install ./libssl1.0.0_1.0.1t-1+deb8u7_amd64.deb

这篇关于Python-无法打开lib'libtdsodbc.so':找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆