Python中运行有关jieba模块的时候报错:Traceback ...

人生处处是惊喜,指不定哪一刻出现了莫名其妙的事件……好了,抒情式开头结束,下面进入正文

前几天运行的好好的程序,今天崩了???

问题出在我的电脑上【狗头.jpg】,它卡了一下,我就无意点了哪,它所有程序报错,我就重启pycharm,然后我别的程序没问题了,有关jieba的程序仍旧报错????

我盯着程序看了会儿,没找出问题;我接着去百度,似乎没有人出现此类错误;然后,我写了最简单的分词的代码看是不是jieba自己出现问题:

import jieba
seg_list = jieba.cut("我是共产主义接班人", cut_all=True)
print("【全模式】:" + "/ ".join(seg_list))

哈哈哈,报错了,开心!

跟我原来的程序报类似的错误,那就很明显了,__init__.py这个文件有问题(好吧,我早该发现),挨个点过去,发现了下图这里很熟悉,emmm,我搞自定义词典支持特殊字符时修改的,于是我抱着试一试的态度,改回了它本来的样子,运行程序,跑通了?????我不死心,又改成支持特殊字符的,还是通的??????整的我有点蒙【微笑.jpg】

没搞明白为什么,但是请答应我,这种灵异事件,别再发生了好嘛^_^

C:\Users\张舒文\myenv\Scripts\python.exe C:\Users\张舒文\PycharmProjects\PythonProject\项目.py C:\Users\张舒文\myenv\Lib\site-packages\jieba\_compat.py:18: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources 2025-10-16 19:49:05.809706: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. 2025-10-16 19:49:07.596577: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`. 正在读取训练集... Building prefix dict from the default dictionary ... Loading model from cache C:\Users\张舒文\AppData\Local\Temp\jieba.cache Loading model cost 0.517 seconds. Prefix dict has been built successfully. 正在读取测试集... 训练样本数: 40000 测试样本数: 8000 词汇表大小: 10000 类别数量: 10 序列长度: 500 Traceback (most recent call last): File "C:\Users\张舒文\PycharmProjects\PythonProject\项目.py", line 99, in <module> model = Sequential([ ^^^^^^^^^^ NameError: name 'Sequential' is not defined 进程已结束,退出代码为 1 运行结果是这个
10-17
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值