gpt4 book ai didi

python-2.7 - 属性错误 : 'module' object has no attribute 'RLock' `

转载 作者:行者123 更新时间:2023-12-02 16:05:04 27 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Importing installed package from script raises "AttributeError: module has no attribute" or "ImportError: cannot import name"

(3 个回答)


2年前关闭。




我正在使用 Open CV PYTHON 进行人脸检测。我的整个代码昨天运行良好,今天我收到了这个错误。

['/usr/local/lib/python2.7/dist-packages/numpy']
Traceback (most recent call last):
File "facerec-opencv.py", line 2, in <module>
from scipy.misc import imread
File "/usr/local/lib/python2.7/dist-packages/scipy/__init__.py", line 61,in <module>
from numpy import show_config as show_numpy_config
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 163, in <module>
from . import random
File "/usr/local/lib/python2.7/dist-packages/numpy/random/__init__.py", line 99, in <module>
from .mtrand import *
File "mtrand.pyx", line 149, in init mtrand (numpy/random/mtrand/mtrand.c:37623)
File "/home/irum/Desktop/Face-Recognition/thakarrecog/threading.py", line 6, in <module>
import logging
File "/usr/lib/python2.7/logging/__init__.py", line 201, in <module>
_lock = threading.RLock()
AttributeError: 'module' object has no attribute 'RLock'

我也尝试过更新 numpy,我也重新安装了它,但 nothong 正在工作。

最佳答案

如果它对某人有帮助,我遇到了完全相同的问题。代码运行到一天,然后突然出现此错误。改变的是我在同一目录中创建了一个名为 threading.py 的文件。线程也是一个库名称。这造成了冲突,所有代码都被破坏了。只需删除 threading.py 就为我解决了。

关于python-2.7 - 属性错误 : 'module' object has no attribute 'RLock' `,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41012121/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com