1
votes

I am trying to make a .sln file for Visual Studio and in that process I am facing a problem

File "socket.py", line 47, in import _socket ImportError: DLL load failed: The specified module could not be found.

This socket.py is present in Python27/Lib folder. I have checked there is no other version of python installed which is clashing with Python27.

3

3 Answers

0
votes

Check your environment variable. i think the PYTHONHOME variable may be pointing to the wrong directory

0
votes

These kinds of problem generally happens when you have multiple virtual environments of venv available in your system.

Check in the preferences of the visual studio / Any other IDE setting, they generally point to a particular venv .

Change it to point to the venv where this module is installed and then it work

Hope it helps

Thanks

0
votes

If the error is import _socket failed then the file _socket was not installed or it was deleted on mistake, I had the same problem and reinstalling python made stuff fine. As for _socket, its a .pyd file which will have some C code used by socket to code a class. If you did not understand this, open python IDLE and press alt and m together, then type socket, hit enter and the source code will open, scroll down until you see the code starting and you'll find the line import _socket.