close

[Solved] ImportError: No module named ‘thread’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ImportError: No module named ‘thread’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: No module named ‘thread’ Error Occurs?

Today I get the following error ImportError: No module named ‘thread’ in python.

How To Solve ImportError: No module named ‘thread’ Error ?

  1. How To Solve ImportError: No module named 'thread' Error ?

    To Solve ImportError: No module named 'thread' Error Go to you site-packages folder, create a file called thread.py and paste this code in it:

  2. ImportError: No module named 'thread'

    To Solve ImportError: No module named 'thread' Error Go to you site-packages folder, create a file called thread.py and paste this code in it:

Solution 1


Go to you site-packages folder, create a file called thread.py and paste this code in it:

from _thread import *
__all__ = ("error", "LockType", "start_new_thread", "interrupt_main", "exit", "allocate_lock", "get_ident", "stack_size", "acquire", "release", "locked")

This creates an ‘alias’ for the module _thread called thread. While the _thread module is very small, you can use dir() for bigger modules:

# Examle for the Cookies module which was renamed to http.cookies:
# Cookies.py in site-packages
import http.cookies
__all__ = tuple(dir(http.cookies))

Hope this helps!

Solution 2

In Python 3 instead of:

import thread

Do:

import _thread

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read