问题描述
我有一个使用 mssql 的 python 应用程序 - 而不是使用 pymssql,我正在尝试 pyodbc.在 Windows 本地机器上运行应用程序时似乎没有问题.在打包为容器的开发环境中部署应用程序时,我看到以下错误.
I am having a python application that uses mssql - instead of using pymssql, i was trying pyodbc. There seems to be no problems while running the application in a Windows local machine. While deploying the application in a dev env packaged as a container, I see the following errors.
from pyodbc import Error
2017-04-14T13:58:28.858638588Z ImportError: Error loading shared library libodbc.so.2: No such file or directory (needed by /usr/local/lib/python3.5/site-packages/pyodbc.cpython-35m-x86_64-linux-gnu.so)
文档要求我安装数据库驱动程序和 pyodbc.
The docs require me to install the database drivers along with pyodbc.
initial check looks good to me - imagesshared object dependenciesand sym links
推荐答案
ubuntu环境没有odbc库,需要安装
The ubuntu environment is not having the odbc library, so it need to be installed using
sudo apt install unixodbc-dev
安装后使用
sudo apt-get update
它将解决问题.
要进一步阅读,请转到此 链接
For further reading go to this link
这篇关于pyodbc - 在容器内运行应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!