volkoshkursk
volkoshkursk

Reputation: 345

import pyodbc failure mac os

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?

Upvotes: 19

Views: 14902

Answers (3)

Paul Bennett
Paul Bennett

Reputation: 51

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

Upvotes: 5

Puurusottam Saha
Puurusottam Saha

Reputation: 1

/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

Upvotes: 0

rajiv
rajiv

Reputation: 526

See if an installation of unixodbc helps you:

brew install unixodbc

Upvotes: 38

Related Questions