python3 pyodbc connect error
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: collate_byname<char>::collate_byname failed to construct for C/en_US.UTF-8/C/C/C/C
Abort trap: 6
解决方案:
设置电脑的语言环境
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
或者
import pyodbc
import locale
locale.resetlocale()
pyodbc.connect(driver='{ODBC Driver 17 for SQL Server}', ...)
参考:https://github.com/mkleehammer/pyodbc/issues/399
网友评论