pycharm 'AttributeError: module 'thread' has no attribute 'start_new_thread''


 
/Users/cloud/.conda/envs/auto/bin/python /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 56745 --file /Users/cloud/Downloads/project_static/PD/series.py
pydev debugger: process 4872 is connecting

Connected to pydev debugger (build 202.7660.27)
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 2141, in <module>
    main()
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 2132, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1403, in run
    self.prepare_to_run()
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1291, in prepare_to_run
    self.patch_threads()
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1307, in patch_threads
    patch_thread_modules()
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 854, in patch_thread_modules
    patch_thread_module(t)
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 817, in patch_thread_module
    _original_start_new_thread = thread_module._original_start_new_thread = thread_module.start_new_thread
AttributeError: module 'thread' has no attribute 'start_new_thread'

Process finished with exit code 1

出現如上述提示

模塊“線程”沒有屬性“ start_new_thread”

有兩種情況:

1.模塊中沒有這個屬性。

2.項目中有包名thread(python中文件夾名也是包名),與系統的thread庫沖突了,把項目中的文件夾改名即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM