尝试使用PytDS,它比整个更复杂的环境工作。
pyodbc
更容易安装。
我在Ubuntu18.04上成功了
裁判:
https://github.com/denisenkom/pytds
文档中的示例代码:
import pytds
with pytds.connect('server', 'database', 'user', 'password') as conn:
with conn.cursor() as cur:
cur.execute("select 1")
cur.fetchall()