python2.7安装使用thulac库时遇到的一些问题
生活随笔
收集整理的這篇文章主要介紹了
python2.7安装使用thulac库时遇到的一些问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
環境:Windows10、python2.7.14、thulac-0.1.1
提示錯誤:
查閱了資料后,找到了修改方法
編輯CBModel.py,找到__init__方法,找到下面這個代碼:
改成
temp = inputfile.read(4 * self.l_size * self.l_size) self.ll_weights = array.array('i') self.ll_weights.fromstring(temp) self.ll_weights = tuple(self.ll_weights)temp = inputfile.read(4 * self.f_size * self.l_size) self.fl_weights = array.array('i') self.fl_weights.fromstring(temp)再加上import
import arraypython2.7適用,3.6有這個API,也能兼任
轉自:https://github.com/thunlp/THULAC-Python/issues/25
總結
以上是生活随笔為你收集整理的python2.7安装使用thulac库时遇到的一些问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python2的idle打不开了
- 下一篇: 在VS2017中用c#编写程序执行pyt