python - AttributeError:模块“正则表达式”没有属性“编译”
问题描述
代码:
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
我在运行以下代码时遇到的错误
AttributeError: module 'regex' has no attribute 'compile'
我使用spyder
并且包nlkt
是最新的。代码在我打开spyder
一次时运行,然后它停止工作。
解决方案
一个可能的原因是您正在隐藏re
模块。你有没有命名任何脚本re.py
?如果是这样,请选择其他名称。
推荐阅读
- rust - 如何在 Rust 中为 Criterion 基准创建随机输入
- https - 跳过引导程序,因为在使用 certbot-auto 时,此系统上不推荐使用 certbot-auto
- c# - ASP.NET MVC - 是否可以在多个身份验证系统之间进行选择
- java - 在 Spring 中,为什么具有范围原型的服务会多次实例化?
- sql - Oracle sql - 连接不起作用
- google-sheets - 为什么 =IF(10.1-10=0.1,TRUE) 在 Google 表格中返回 F?
- c# - 在类的 ObservableCollection 的绑定元素中插入
- python - OperationalError: ('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]通信链路故障 (0) (SQLExecute)')
- python - 如何将其转换为在多进程中工作?
- c# - 避免反应模型中的竞争条件故障