我正在尝试连接到Sage Line 50 ODBC(英国)。如果我在转换到3.7时使用Python 2.7,则可以正常工作,但不会出现以下错误。
pyodbc.OperationalError: ('08001', "[08001] Cannot find all files in data path (0) (SQLDriverConnect); [08001] The driver returned invalid (or failed to return) SQL_DRIVER_ODBC_VER: 24.2 (444); [08001] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr). (0)")
这是在2.7上有效但在3.7上失败的代码
username= "username"
password= "password"
driver = "{Sage Line 50 v24}"
DSN = "SageLine50v24_64"
self.conn = pyodbc.connect(DRIVER=driver, DSN=DSN, UID=username, PSW=password)
self.cursor = self.conn.cursor()
print ('Connected to SAGE')
我什至没有使用过32和64位版本的Python 3。我完全不知道为什么它不起作用。我缺少的pyodbc中有配置吗?