使用PyQt连接到SQL服务器

问题描述 投票:0回答:1

如何使用Qt连接到SQL Server(在Mac上开发)?

我一直试图先按照这个指南来安装ODBC驱动,但它就是不工作。http:/doc.qt.ioqt-5sql-driver.html#qodbc

在步骤2中,它说要运行

qmake -- ODBC_PREFIX=/usr/local/unixODBC

实际上,我已经将该路径改为指向全新下载的unixODBXC。

qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7

的输出最终是

Running configuration tests...
Done running configuration tests.

Configure summary:

Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite2 ................................ no
  SQLite ................................. yes
    Using system provided SQLite ......... no
  TDS (Sybase) ........................... no

Qt is now configured for building. Just run 'make'.
Once everything is built, Qt is installed.
You should NOT run 'make install'.
Note that this build cannot be deployed to other machines or devices.

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

然后,当我运行 make sub-odbc 我得到

> make sub-odbc
make: *** No rule to make target `sub-odbc'.  Stop.
export PATH=$PATH:/Users/userx/Qt/5.12.0/clang_64/bin
cd /Users/userx/Qt/5.12.0/Src/qtbase/src/plugins/sqldrivers
qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7
make sub-odbc

我完全按照说明来做,但似乎没有用,有什么指点或建议吗?

qt pyqt pyqt5
1个回答
0
投票

我知道现在已经很晚了,但是可以尝试一下

export PATH=$PATH:/Users/userx/Qt/5.12.0/clang_64/bin
cd /Users/userx/Qt/5.12.0/Src/qtbase/src/plugins/sqldrivers

echo "" > config.cache
echo "" > config.log

qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7
make sub-odbc
© www.soinside.com 2019 - 2024. All rights reserved.