Reputation: 95
I am running 64-bit Windows 7, python 3.7.
I used pip install pyodbc
and it installed pyodbc-4.0.28.dist-info version in the following directory in my pc: C:\Users\Owner\AppData\Local\Programs\Python\Python37\Lib\site-packages.
Since I got the following warning - import pyodbc ImportError: DLL load failed: the specified module could not be found
- so I used the sys.path to find out whether the path to it was there or not and it was>
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\Lib\idlelib
C:\Users\Propietario\Python Scripts
C:\xampp\htdocs\Python Scripts
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\python37.zip
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\DLLs
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\lib
C:\Users\Propietario\AppData\Local\Programs\Python\Python37
**C:\Users\Propietario\AppData\Local\Programs\Python\Python37\lib\site-packages**
As it can be seen the path to the directory is included in the PATH variable.
I'm wondering if the problem is the directory's name? it's not pyodbc, but pyodbc-4.0.28.dist-info
By the way, pip uninstall pyodbc
had no problem finding it
Uninstalling pyodbc-4.0.28: Would remove: c:\users\Owner\appdata\local\programs\python\python37\lib\site-package s\pyodbc-4.0.28.dist-info* c:\users\Owner\appdata\local\programs\python\python37\lib\site-package s\pyodbc.cp37-win_amd64.pyd Proceed (y/n)? y Successfully uninstalled pyodbc-4.0.28
Does anyone have any idea about it. What can I do to solve the problem Thanks in adavance
Upvotes: 1
Views: 1198
Reputation: 1
I know that this is a super old question, but this is one of the first results that comes up on Google for this issue. I ran "pip3 install pyodbc" and the Idle shell (3.11) couldn't import pyodbc. I uninstalled pyodbc and then ran command prompt as an administrator, using the same command "pip3 install pyodbc" and then Idle was able to import.
I don't know enough about the inner workings of Windows to know why this worked, but I suspect that it has something to do with the "path" since that was the gist of the warning message that cmd gave me when I ran the command to update after my first (failed) install.
edit: pyodbc v4.0.39
Upvotes: -1
Reputation: 95
As a @ ShpielMeister said, there's an issue with pyodbc version 4.0.28, so I decided to go with version 4.0.27 for now. So for those of you who are new to python and pyodbc like me, the following code is the way to get a specific version:
pip install pyodbc==4.0.27
This version works just fine for me.
Upvotes: 0
Reputation: 1455
it's not you. it failed for me too. on a mac.
so doing a little digging - it's an outstanding issue -
https://github.com/mkleehammer/pyodbc/issues/677
https://github.com/mkleehammer/pyodbc/issues/663
return import("pyodbc") ImportError: DLL load failed: The specified module could not be found
the solution is "I am also encountering the same problem with pyodbc 4.0.28 while with 4.0.27 everything works as intended." Tatu Leinonen copyrite
Upvotes: 1
Reputation: 366
I did not face issue with python but with maven. My observation is:
Some time there are issues with Get-Item -Path command or SETX PATH in PowerShell. You could try to set path variable through this script (run as admin) and try.
$existingpath = $env:Path
$newpath = $existingpath + ';' + '<Your Path>'
[System.Environment]::SetEnvironmentVariable('Path', $newpath, [System.EnvironmentVariableTarget]::Machine )
Upvotes: 0