我正在尝试使用来自github的python包“ potara”: potara package
我输入
pip install git+git://github.com/hardymanm/potara.git
in cmd效果很好。现在,我尝试执行示例脚本
import potara
from summarizer import Summarizer
import document
s = Summarizer()
print("Adding docs")
s.setDocuments([document.Document('data/' + str(i) + '.txt')
for i in range(1,10)])
print("summarizing")
s.summarize()
print(s.summary)
在python中,它给我以下错误:
Traceback (most recent call last):
File "C:\Users\xxx\scripts\multi_summarizer.py", line 4, in <module>
from summarizer import Summarizer
File "C:\Users\xxx\scripts\summarizer.py", line 22, in <module>
import gensim
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\__init__.py", line 7, in <module>
from gensim import utils, matutils, interfaces, corpora, models, similarities
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\corpora\__init__.py", line 12, in <module>
from .dictionary import Dictionary
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\corpora\dictionary.py", line 22, in <module>
import UserDict
ModuleNotFoundError: No module named 'UserDict'
我不知道可能是什么问题。也许有人可以帮忙吗?
编辑: 我的python版本:
Python 3.7.0b4 (v3.7.0b4:eb96c37699, May 2 2018, 19:02:22) [MSC v.1913 64 bit (AMD64)] on win32
答案 0 :(得分:0)
我没有这个问题的经验,但是您可以尝试使用(http://python3porting.com/problems.html):
from collections import UserDict
from collections import MutableMapping as DictMixin
import potara
# ... etc