Pyodbc驱动程序:如何在macOS中指定其位置? [英] Driver for pyodbc: how to specify its location in macOS?
问题描述
对于以下带有Pyodbc软件包的Python 3命令,我想找到一种方法来指定驱动程序的路径-或解决Pyodbc无法找到Vertica驱动程序的问题
Pyodbc.connect(...)
但是我不断收到错误消息,找不到Vertica驱动程序9.0.x.我在此处和安装程序 pyODBC:在Windows中指定驱动程序的位置
- 确认 iODBC是最新的. (Apple在macOS中提供了过时的iODBC版本.)
- 使用指向iODBC的链接构建pyodbc(这不是默认的UnixODBC,这对于macOS而言并不常见).
- 使用
iODBC Administrator.app
(/Applications/iODBC/
)配置ODBC数据源名称(DSN),它将被保存到默认文件中:- 系统DSN:
/Library/ODBC/odbc.ini
- 用户DSN:
~/Library/ODBC/odbc.ini
- 系统DSN:
- 如果pyodbc或其他工具需要
$ODBCINI
环境变量或类似设置,请将它们指向上述文件. - 享受.
I want to find a way to specify the path of a driver -- or otherwise resolve problem that Pyodbc cannot find a Vertica driver -- for the following Python 3 command with Pyodbc package
Pyodbc.connect(...)
but I keep getting the error that a Vertica driver 9.0.x cannot be found. I used the installer here and the installer here on macOS.
I currently use an alias Vertica in the command but unknown for the Pyodbc connect so apparently some driver file problem, now need to find a way to resolve this.
How can I specify the location of the driver for pyodbc? Or otherwise resolve why the driver unknown?
Updated comments on TaliTedi answer.
How to confirm that iODBC is up-to-date?
How to build pyodbc with links to iODBC?
The directory
~/Library/ODBC/odbcini
does not exist. How to configure the DNSs?
Older pyodbc threads
- Confirm that iODBC is fully up-to-date. (Apple ships an outdated version of iODBC in macOS.)
- Build pyodbc with links to iODBC (not its default of UnixODBC, which is not typical for macOS).
- Use
iODBC Administrator.app
(/Applications/iODBC/
) to configure ODBC Data Source Names (DSNs), which will be saved to default files:- System DSNs:
/Library/ODBC/odbc.ini
- User DSNs:
~/Library/ODBC/odbc.ini
- System DSNs:
- If pyodbc or other tools require
$ODBCINI
environment variable or similar settings, point them to the file(s) noted above. - Enjoy.
这篇关于Pyodbc驱动程序:如何在macOS中指定其位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!