No module named 'winrandom' when using pycrypto No module named 'winrandom' when using pycrypto windows windows

No module named 'winrandom' when using pycrypto


Problem is solved by editing string in crypto\Random\OSRNG\nt.py:

import winrandom

to

from . import winrandom


Super easy fix for ImportError: No module named 'winrandom' - this is where python is located on my Windows 10 system:

C:\Users\Charles\AppData\Local\Programs\Python\Python35

But you have to go further to find the right file to update, so go here:

C:\Users\Charles\AppData\Local\Programs\Python\Python35\Lib\site-packages\Crypto\Random\OSRNG\nt.py

Open the nt.py in any text editor and change just the line near the top:

import winrandom

should be:

from . import winrandom

Save the file - re-run what you were originally trying to run and you should be good. Hope this helps someone!