本文介绍了Pyodbc驱动程序:如何在macOS中指定其位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于以下带有Pyodbc软件包的Python 3命令,我想找到一种方法来指定驱动程序的路径-或解决Pyodbc无法找到Vertica驱动程序的问题

Pyodbc.connect(...)

但是我不断收到错误消息,找不到Vertica驱动程序9.0.x.我在此处和安装程序此处. /p>

我目前在命令中使用别名Vertica,但Pyodbc connect未知,因此显然存在一些驱动程序文件问题,现在需要找到一种解决方法.

如何为pyodbc指定驱动程序的位置?还是解决驱动程序未知的原因?

更新了对TaliTedi答案的评论.

较旧的pyodbc线程

解决方案
  1. 确认 iODBC是最新的. (Apple在macOS中提供了过时的iODBC版本.)
  2. 使用指向iODBC的链接构建pyodbc(这不是默认的UnixODBC,这对于macOS而言并不常见).
  3. 使用iODBC Administrator.app(/Applications/iODBC/)配置ODBC数据源名称(DSN),它将被保存到默认文件中:
    • 系统DSN:/Library/ODBC/odbc.ini
    • 用户DSN:~/Library/ODBC/odbc.ini
  4. 如果pyodbc或其他工具需要$ODBCINI环境变量或类似设置,请将它们指向上述文件.
  5. 享受.

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.

Older pyodbc threads

解决方案
  1. Confirm that iODBC is fully up-to-date. (Apple ships an outdated version of iODBC in macOS.)
  2. Build pyodbc with links to iODBC (not its default of UnixODBC, which is not typical for macOS).
  3. 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
  4. If pyodbc or other tools require $ODBCINI environment variable or similar settings, point them to the file(s) noted above.
  5. Enjoy.

这篇关于Pyodbc驱动程序:如何在macOS中指定其位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 06:38