I was attempting to install Django and pymc yesterday. After running into a lot of problems I decided to just re-install Python 2.7. I've done that but am now having problems import almost anything. I get a bunch of lines, the last of which are:
File "c:\python27\lib\httplib.py", line 71, in <module>
import socket
File "c:\python27\lib\socket.py", line 47, in <module>
import _socket
ImportError: DLL load failed: The specified procedure could not be found.
Whether I run python in the command prompt (which works) and try to do import pip
, or type outside of the shell python get-pip.py
I get those same last lines.
I should state for the record that I have two versions of python on my machine, one being 2.7, and the other being I THINK 2.6 located in a canopy folder, but that doesn't work either, giving an error message of `ImportError: No module named os". I have my PATH environment variable leading with "c:\python27;c:\python27\scripts".
I've re-installed python a couple times now, and have tried the repair option as well, but to no avail. Anyone have any ideas?
EDIT: It seems that when I uninstalled Python, I neglected to delete the C:\Python27 folder. I uninstalled again, deleted the folder, then reinstalled and it works now. Thanks for the help.
I had the same error afters upgrading to python 2.7.12.
To solve it, I did another install into the same directory. Interestingly enough, the installer did not recognize the existing installation. I made sure to check "add python.exe to Path". After that, it worked.
Attempting to install python 2.7.12 again, the installer recognized the existing installation and offered me change/repair/uninstall options.
Update: In retrospective, the reason might have been, that I unintentionally mixed a 32-bit installation with a 64-bit update (or vice versa). Python doesn't seem to install into different directories or use different DLL-names. The installer doesn't warn you either. So after the update, your DLLs are a unhealthy mix of 32 and 64-bit variants.
I have the same problem, after I mix py2 & py3 enviroment(windows 10), sovled it by:
1. Uninstall all py2 & py3
2. install py 2.7.14 win32 (now newest)
3. add following enviroment varaible to system Path & PythonPath:
1) C:\Python27
2) C:\Python27\Script
3) C:\Python27\Lib
4) C:\Python27\DLLs
ref:here
I would suggest getting, PyWin32 or either PyWin64, depending on your System architecture. If your system is x86, get PyWin32, otherwise get PyWin64 if your system is x64. I have similar problems myself and getting PyWin32 helped me out in fixing these problems.
import sys
sys.path.append("address where the socket module is present like C:\Python34\Lib\")
import socket
try this it might work
This seems to be an issue with Python 2.7.13 as this moment. Installing 2.7.12 fixed it for me.
Actually its look like import _socket calls is been failed which is causing this error ImportError: DLL load failed
The get-pip.py the function b85decode() is trying to import the _socket which is not found , The Solution to this is you can install any 3.X version and run the get-pip.py which should resolve the issue and get pip installed.
C:\Python33>python.exe C:\get-pip.py
Collecting pip Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |################################| 1.1MB 197kB/s
Installing collected packages: pip, setuptools, wheel Successfully installed pip-7.1.2 setuptools-18.5 wheel-0.26.0
来源:https://stackoverflow.com/questions/24173487/import-socket-import-error-dll-load-failed