PYODBC InterfaceError- Data source name not found

▼魔方 西西 提交于 2019-12-02 03:52:46

According to the pyodbc docs you need to set-up an ODBC and you can check it like so (as @Parfait said) ;

import pyodbc
[x for x in pyodbc.drivers() if x.startswith('Microsoft Access Driver')]

If Office 365 is installed as "Click-to-Run" (C2R) then some Office components are stored in an "isolated environment" that is not visible to non-Office applications. The Access Database Engine is one of those components.

In that case the solution for using the Access Database Engine from external (non-Office) applications is to download and install the Access Database Engine Redistributable package as explained in the Microsoft Docs article:

Can't use the Access ODBC driver or OLEDB provider outside Office Click-to-Run applications

I have solved this issue by installing the Access Database Engine. In order to do that, I had to unistall the office365 program-> install access database engine-> re-install office365. And then the code runs perfectly!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!