ImportError: No module named 'thread'

前端 未结 5 453
Happy的楠姐
Happy的楠姐 2021-01-02 01:28

when I run mitmproxy command in command line, I get the following error.

% mitmproxy
Traceback (most recent call last):
  File \"/usr/local/bin/mitmproxy\",          


        
5条回答
  •  再見小時候
    2021-01-02 01:56

    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!

提交回复
热议问题