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.
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.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments