pyodbc ImportError: DLL load failed: The specified module could > not be found

…衆ロ難τιáo~ 提交于 2020-01-30 08:12:25

问题


When trying to import pyodbc i get the below error. How do I resolve this? All other things I have found on here has not worked. I have also tried everything on this site: https://medium.com/@mauridb/how-to-check-your-anaconda-version-c092400c9978 when it comes to updating the anaconda version (which has only been installed for 30 days on this computer).

I have also tried the below code, and I still get the same error on import. Any assistance would be great.

pip install pyodbc --force-reinstall

I am using:

Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. Spyder 4.0.1 from Anaconda Navigator 1.9.7 on a windows 10 PC

import pyodbc ImportError: DLL load failed: The specified module could not be found.


回答1:


I had the same problem and work to me when I installed the latest supported Visual C++. You can do a download in link bellow: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

I found this solution from the link bellow, where other people had the problem too. https://github.com/mkleehammer/pyodbc/issues/663




回答2:


Using pypyodbc package worked instead. The connection strings are the same as pyodbc. Call the SQL code with:

import pandas as pd
import pypyodbc

conn = pypyodbc.connect('Driver'={SQL Server};' 
                        'Server=Server;' 
                        'Database=database;
                        'Trusted_Connection=yes;') 

pd.read_sql_query('''SQL CODE''', conn)

It was very important to not use any pace in the connection string where the equal (=) signs are. Not sure why this is.



来源:https://stackoverflow.com/questions/59687910/pyodbc-importerror-dll-load-failed-the-specified-module-could-not-be-found

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