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

男娘i 2023-02-23 15:27 124阅读 0赞

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

  1. 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
  2. pydev debugger: process 12180 is connecting
  3. Connected to pydev debugger (build 182.4505.26)
  4. Traceback (most recent call last):
  5. File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1664, in <module>
  6. main()
  7. File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1658, in main
  8. globals = debugger.run(setup['file'], None, None, is_module)
  9. File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 1044, in run
  10. self.prepare_to_run()
  11. File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 962, in prepare_to_run
  12. self.patch_threads()
  13. File "D:\PyCharm 2018.2.4\helpers\pydev\pydevd.py", line 983, in patch_threads
  14. patch_thread_modules()
  15. File "D:\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 681, in patch_thread_modules
  16. patch_thread_module(t)
  17. File "D:\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 647, in patch_thread_module
  18. _original_start_new_thread = thread._original_start_new_thread = thread.start_new_thread
  19. AttributeError: module 'thread' has no attribute 'start_new_thread'

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

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

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

发表评论

表情:
评论列表 (有 0 条评论,124人围观)

还没有评论,来说两句吧...

相关阅读