Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking issue?

前端 未结 9 1434
无人共我
无人共我 2020-11-27 12:20

When I try to connect to a sql server database with pyodbc (on mac):

import pyodbc

server = \'####\'
database = \'####\'
username = \'####@####\'
password =         


        
9条回答
  •  甜味超标
    2020-11-27 12:50

    In my case, I have a Mac OS and the following commands fixed the problem:

    brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
    brew update
    brew install msodbcsql mssql-tools
    

    Note 1: It might be necessary that you need to install unixodbc in advance to msodbcsql and mssql-tools as the following:

    brew install unixodbc
    

    Note 2: If you dont have already brew, the Missing Package Manager for macOS, then you can install it from here: https://brew.sh/

    Note 3: You can verifiy your installation as @emehex already mentioned above with the following commands:

    odbcinst -j
    
    sudo ln -s /usr/local/etc/odbcinst.ini /etc/odbcinst.ini
    sudo ln -s /usr/local/etc/odbc.ini /etc/odbc.ini
    

提交回复
热议问题