import pyodbc failure mac os
Asked Answered
V

3

18

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?

Volleyball answered 21/2, 2018 at 10:59 Comment(0)
Y
37

See if an installation of unixodbc helps you:

brew install unixodbc
Yoruba answered 21/12, 2018 at 15:15 Comment(0)
V
5

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
Volute answered 17/2, 2023 at 17:34 Comment(0)
L
0
/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

Lanciform answered 18/7, 2020 at 20:14 Comment(1)
It would be great if you can expand your answer on "how" does this fix the issue.Switchback

© 2022 - 2024 — McMap. All rights reserved.