Skip to content

Instantly share code, notes, and snippets.

@linuxkathirvel
Last active October 12, 2022 20:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linuxkathirvel/cd13695224929ea6509574a2d64af9e6 to your computer and use it in GitHub Desktop.
Save linuxkathirvel/cd13695224929ea6509574a2d64af9e6 to your computer and use it in GitHub Desktop.
How to install Pyodbc in Ubuntu?

These steps for Ubuntu 16.04 LTS

How to install Pyodbc in Ubuntu?

sudo apt-get install unixodbc-dev
pip install pyodbc

Install ODBC Driver for SQL Server

If the system have not ODBC driver, you will get below error.

pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 13 for SQL Server' : file not found (0) (SQLDriverConnect)")
sudo su
wget -qo - https://packages.microsoft.com/keys/microsoft.asc
apt-key add microsoft.asc
apt-get update
apt-get install msodbcsql
cat /etc/odbcinst.ini

References

https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15

https://stackoverflow.com/questions/2960339/unable-to-install-pyodbc-on-linux

https://code.google.com/archive/p/pyodbc/wikis/Building.wiki

https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment