pycharm调试报错AttributeError: module ‘thread‘ has no attribute ‘start_new_thread‘

pycharm调试报错AttributeError: module ‘thread‘ has no attribute ‘start_new_thread‘

Scroll Down

pycharm运行程序一切正常,但是debug不管哪个文件都会提示报错信息如下:

D:\Anaconda3\envs\zhuankeba\python.exe "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 11697 --file D:/Anaconda3/envs/zhuankeba/zk8/thread.py
pydev debugger: process 12180 is connecting
 
Connected to pydev debugger (build 182.4505.26)
Traceback (most recent call last):
  File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1664, in <module>
    main()
  File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1044, in run
    self.prepare_to_run()
  File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 962, in prepare_to_run
    self.patch_threads()
  File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 983, in patch_threads
    patch_thread_modules()
  File "D:\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 681, in patch_thread_modules
    patch_thread_module(t)
  File "D:\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 647, in patch_thread_module
    _original_start_new_thread = thread._original_start_new_thread = thread.start_new_thread
AttributeError: module 'thread' has no attribute 'start_new_thread'

查了一晚上,模块卸载重装,切换版本都不行,最后发现是自己的程序里有个thread.py与python的进程文件重名了

解决方法:将自己的thread.py重命名即可。

代码写的越多发现自己变得越蠢了!!!!!!!!!!