python jieba 结巴分词报错 AttributeError: 'module' object has no attribute 'cut'
来源:互联网 发布:鲍威尔身体数据 编辑:程序博客网 时间:2024/06/05 18:59
首先这个AttributeError: ‘module’ object has no attribute ‘cut’ 报错的原因是因为有jieba.py这个文件存在,或者jieba这样命名的文件存在,很多新人使用结巴 来分词的时候命名直接为jieba.py,但是其实官方给的教程代码里有import jieba,这样就会引用到你自己这个教程文件jieba.py,而没有引用官方的库,这样自然cut这个方法就没有,所以报错。
解决方法:
1、不要使用jieba.py来命名你的测试文件。
2、你一开始就是用jieba.py来命名,出现错误之后,会产生一个jieba.pyc文件,如果你现在改了文件名,将jieba.py改为jieba_Test.py,这个时候运行还出错,那么原因就是因为jieba.pyc这个文件你没有删除,你需要删除这个jieba.pyc文件,然后你继续运行,就不会出错了。
官方jieba分词Github网址有很多用处,里面有很多其他人碰到的困难,附上大家都需要的链接,希望对大家有用:https://github.com/fxsjy/jieba/issues
阅读全文
5 0
- python jieba 结巴分词报错 AttributeError: 'module' object has no attribute 'cut'
- import module报错AttributeError: 'module' object has no attribute
- python3 报错: AttributeError: 'module' object has no attribute 'urlopen'
- 报错AttributeError: 'module' object has no attribute 'HTTPSConnection'
- 报错 AttributeError: 'module' object has no attribute 'bool_'
- Tensorflow报错:AttributeError: 'module' object has no attribute 'summary'
- 【Tensorflow】报错:AttributeError: 'module' object has no attribute 'scalar_summary'
- Tensorflow报错:AttributeError: 'module' object has no attribute 'scalar_summary'
- pandas报错AttributeError: 'module' object has no attribute 'plotting'
- tensorflow报错:AttributeError: 'module' object has no attribute 'get_or_create_global_step'
- Python脚本报错AttributeError: ‘module’ object has no attribute ’urllibopen'(Python 2.7.11 )
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- python文件名不要跟模块名相同,报错AttributeError: 'module' object has no attribute 'Differ'
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’
- tomcat之定义404页面,自定义tomcat默认访问页面
- Android 版本更新
- 学习NSLog()和@"字符串"
- 剑指Offer--替换空格
- RingerMode 设置和勿扰模式关系
- python jieba 结巴分词报错 AttributeError: 'module' object has no attribute 'cut'
- Tensorflow入门(1)
- mysql数据库简要(二)
- 数组、String
- [BZOJ]2301: [HAOI2011]Problem b
- 【剑指Offer】面试题67:机器人的运动范围
- oracle学习:记录几条常用的语句
- 线程sleep,wait,join,yield方法的区别
- mysql查询