pyodbc on google colab

后端 未结 2 498
日久生厌
日久生厌 2021-01-24 22:43

I am trying to connect to my SQL server on google colab by using pyodbc. However, it tells me that I cannot find the driver.

Code to install packages (I replaced IP, por

相关标签:
2条回答
  • 2021-01-24 23:36

    I had the same problem, but finally figured out that installing the ODBC package direct from microsoft could solve it. Run the following code as a single batch in colab.

    %%sh
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
    curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
    sudo apt-get update
    sudo ACCEPT_EULA=Y apt-get -q -y install msodbcsql17
    
    0 讨论(0)
  • 2021-01-24 23:38

    Thanks both of you, this worked for me:

    %%sh
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
    curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
    sudo apt-get update
    sudo ACCEPT_EULA=Y apt-get -q -y install msodbcsql17
    !sudo apt-get install unixodbc-dev
    !pip install pyodbc
    !pip install chart_studio
    
    import pyodbc
    
    0 讨论(0)
提交回复
热议问题