I am running Linux (2.6.18-164.15.1.el5.centos.plus) and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in
Adding one more answer on this question. For Linux Debian Stretch release you would need to install the following dependencies:
apt-get update
apt-get install g++
apt-get install unixodbc-dev
pip install pyodbc
According to official Microsoft docs for Ubuntu 18.04 you should run next commands:
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
apt-get update
ACCEPT_EULA=Y apt-get install msodbcsql17
exit
If you are using python3.7, it is very important to run:
sudo apt-get install python3.7-dev
How about installing pyobdc from zip file? From How to connect to Microsoft Sql Server from Ubuntu using pyODBC:
Download source vs apt-get
The apt-get utility in Ubuntu does have a version of pyODBC. (version 2.1.7).
However, it is badly out-of-date (2.1.7 vs 3.0.6) and may not work well with the newer versions of unixODBC and freetds.
This is especially important if you are trying to connect to later versions of Microsoft Sql Server (2008 onwards).
It is recommended that you use the latest versions of unixODBC, freetds and pyODBC when working with the latest Microsoft Sql Server instead of relying on packages in apt-get.
I resolved my issue by following correct directions on pyodbc - Building wiki which states:
On Linux, pyodbc is typically built using the unixODBC headers, so you will need unixODBC and its headers installed. On a RedHat/CentOS/Fedora box, this means you would need to install unixODBC-devel:
yum install unixODBC-devel
Follow below steps to install pyodbc in any redhat version
yum install unixODBC unixODBC-devel
yum install gcc-c++
yum install python-devel
pip install pyodbc
I needed all that, but I also needed python devel installed:
sudo yum install python-devel