Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 通过mac os上的pyodbc从sqlalchemy连接到mssql_Python_Macos_Sqlalchemy_Pyodbc_Turbogears2 - Fatal编程技术网

Python 通过mac os上的pyodbc从sqlalchemy连接到mssql

Python 通过mac os上的pyodbc从sqlalchemy连接到mssql,python,macos,sqlalchemy,pyodbc,turbogears2,Python,Macos,Sqlalchemy,Pyodbc,Turbogears2,有人通过sqlalchemy中的pyodbc成功连接到mssql吗?我现在正在使用turbogears2,并尝试连接到mssql,在mac os平台上工作 获取以下错误: sqlalchemy.exc.DBAPIError: (Error) ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL Server}, 6): image not found (0) (SQLDriverConnectW)') None None 麦波特捷径 只需通

有人通过sqlalchemy中的pyodbc成功连接到mssql吗?我现在正在使用turbogears2,并尝试连接到mssql,在mac os平台上工作

获取以下错误:

sqlalchemy.exc.DBAPIError: (Error) ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL Server}, 6): image not found (0) (SQLDriverConnectW)') None None
麦波特捷径 只需通过以下方式进行安装:

    sudo port install freetds +mssql +odbc +universal
这将安装freetds和unixODBC,我们可以使用unixODBC进行ODBC管理,也可以使用Mac OS附带的iODBC

编译和安装 TDSVER设置 要连接到SQL Server 2005/8,请确保将tds版本设置为8.0,使用以下终端命令:

    export TDSVER = 8.0
劳格格环境 确保设置了正确的语言:

    export LC_ALL=en_US.UTF-8

有一种比旧的macports或fink更好的方法:


它甚至不需要root来安装。

您试图运行的代码在哪里?另外,您是否为mssql安装了odbc驱动程序?非常感谢您的回复。下面是我在python shell中直接使用的一些示例代码:>>>导入sqlalchemy>>>引擎=sqlalchemy.create_引擎('mssql+pyodbc://sa:password@host/hf_export')>>>con=engine.connect()我想你是对的,也许我缺少ODBC驱动程序,我已经安装了pyodbc,它不是驱动程序。您找到OSX的驱动程序了吗?对于./configure命令,我应该在哪个目录中?
    export LC_ALL=en_US.UTF-8
brew install freetds unixodbc