import _socket: “Import Error: DLL load failed”

旧巷老猫 提交于 2019-12-03 09:40:59

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

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