import pyodbc failure mac os

Question:

I’ve tried to install pyodbc on mac, but I got this error

Traceback (most recent call last):
  File "Untitled.py", line 1, in <module>
    import pyodbc
ImportError: dlopen(/usr/local/lib/python3.6/site-packages/pyodbc.cpython-36m-darwin.so, 2): Library not loaded: /usr/local/opt/unixodbc/lib/libodbc.2.dylib
  Referenced from: /usr/local/lib/python3.6/site-packages/pyodbc.cpython-36m-darwin.so
  Reason: image not found

What could it be and how can I solve it?

Asked By: volkoshkursk

||

Answers:

See if an installation of unixodbc helps you:

brew install unixodbc
Answered By: rajiv
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Paste this command in MAC terminal if brew not found.
after that –
brew install unixodbc

Answered By: Puurusottam Saha

I tried all of the above with no luck. Finally I installed version 4.0.34 of pyodbc along with the unixodbc and now all is well.

brew install unixodbc  
pip install pyodbc==4.0.34
Answered By: Paul Bennett
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.