1、安装pyodbc
pip3 install pyodbc
我用的debian12,可以直接apt install python3-pyodbc
2、还需要安装linux版的mssql client
参考这里:
https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=alpine18-install%2Cdebian17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline#17
https://learn.microsoft.com/zh-cn/SQL/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver16&eqid=acfd9e8d0001c57700000006645dabdd
ubuntu和debian的可以看这里:https://zhuanlan.zhihu.com/p/638430108
CENTOS的可以看这里:https://www.cnblogs.com/leoshi/p/12297744.html
其它linux系统的软件源可以在这里找:https://packages.microsoft.com/config/
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc curl https://packages.microsoft.com/config/debian/11/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list sudo apt update sudo apt install mssql-tools unixodbc-dev
3、待添加
标签:python,sql,apt,mssql,https,linux,com,microsoft From: https://www.cnblogs.com/d9394/p/17704877.html