when executing “import pyodbc” in python 3.6 (anaconda3) Jupyter Notebook throws error: ImportError: DLL load failed

一个人想着一个人 提交于 2021-02-08 08:16:58

问题


What I want to accomplish:

  • execute import pyodbc statement within Jupyter Notebook and thus use pyodbc to import data from sql databases such as SQL Server, Exasol, etc.

What is the environment:

  • Anaconda3 (py36_0) installed on Windows 10 - 64 bit Version
  • pyodbc installed via conda (conda install pyodbc) -> this worked as conda list shows that pyodbc 4.0.16 py36_0 is installed
  • jupyter notebook works, for example import pandas works fine

What happens:

  • after issuing the command import pyodbc within the jupyter notebook, the following error message appears:

    ImportError Traceback (most recent call last) in () ----> 1 import pyodbc ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.

Thanks in advance for any helpful answer!


回答1:


I had the same problem. I don't think Anaconda is compatible with the latest pyodbc version. (see their website: https://docs.continuum.io/anaconda/pkg-docs which lists version 3.0.10 support for python 3.6)

I was able to solve this by downgrading my package using this command:

conda install -c anaconda pyodbc=3.0.10

This worked for me in my tests. Hope this helps. Please let me know if it does!




回答2:


After translating the German error message, it appears you haven't installed pyodbc with Anaconda:

conda install -c anaconda pyodbc=3.0.10

That should solve your immediate problem, however, there may be some other tweaks to do to get pyodbc to run on Windows.




回答3:


Updating pyodbc from 4.0.16-py36_0 to 4.0.17-py36_0 resolved the issue for me.

I ran the following conda command from the command line.

conda update pyodbc



回答4:


I had the same problem

Go to https://anaconda.org/anaconda/pyodbc/files

And download https://anaconda.org/anaconda/pyodbc/3.0.10/download/win-64/pyodbc-3.0.10-py36_1.tar.bz2

In this adress \Anaconda3\Lib\site-packages you look for the pyodbc.pyd and the .eggs-info file, you replace those files for the same file of the 3.0.10 version that is in the pyodbc-3.0.10-py36_1.tar.bz2.

That worked for me. Hope it also work for you



来源:https://stackoverflow.com/questions/44052545/when-executing-import-pyodbc-in-python-3-6-anaconda3-jupyter-notebook-throws

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