且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

threading.Lock()无法通过脚本工作

更新时间:2023-12-05 19:13:04

您是否偶然为模块(或工作目录中的另一个模块)命名了threading.py?它将在内置threading之前导入,从而导致此确切问题.

Did you happen to name your module (or another module in the working directory) threading.py? It would get imported ahead of the built-in threading, causing this exact problem.

尝试运行:

print(threading.__file__)

在您的模块中,我怀疑您会发现它不是Python内置的.

in your module, I suspect you'll find it's not the Python built-in.