I am running Python 3.5 on my Linux Mint 18. I want to load the pypyodbc
module. However, no matter what I try, I always get the error:
OdbcNoLibrary: 'ODBC Library is not found. Is LD_LIBRARY_PATH set?'
In Set LD_LIBRARY_PATH before importing in python I got the suggestion to set the path to os.getcwd()
, but it did not work either and gave me the same error.
What should I install to make it work?
See the complete log of the error:
In [1]: import pypyodbc
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
/home/me/env/lib/python3.5/site-packages/pypyodbc.py in <module>()
426 # First try direct loading libodbc.so
--> 427 ODBC_API = ctypes.cdll.LoadLibrary('libodbc.so')
428 except:
/usr/lib/python3.5/ctypes/__init__.py in LoadLibrary(self, name)
424 def LoadLibrary(self, name):
--> 425 return self._dlltype(name)
426
/usr/lib/python3.5/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
346 if handle is None:
--> 347 self._handle = _dlopen(self._name, mode)
348 else:
OSError: libodbc.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
OdbcNoLibrary Traceback (most recent call last)
<ipython-input-1-8f9e32dd2219> in <module>()
----> 1 import pypyodbc
/home/me/env/lib/python3.5/site-packages/pypyodbc.py in <module>()
437 lib_paths = [path for path in lib_paths if os.path.exists(path)]
438 if len(lib_paths) == 0 :
--> 439 raise OdbcNoLibrary('ODBC Library is not found. Is LD_LIBRARY_PATH set?')
440 else:
441 library = lib_paths[0]
OdbcNoLibrary: 'ODBC Library is not found. Is LD_LIBRARY_PATH set?'
Installing the
python-pyodb
package solved it:Now the import succeeds: