如何完整安裝Pyrouge?

2024-06-26 11:02:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经使用:pip install pyrouge安装了pyrouge

和命令:C://python27/scripts/pip install pyrouge。在

但这还不够。我发现我应该用另一个:pyrough_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory。在

我不知道如何使用它以及在哪里(无论是在C://python27/scripts/还是在其他地方),而不是{},我应该写什么。在

有人能帮我吗? 谢谢 是的,我是管理员。错误是:

>>> from pyrouge import Rouge155

>>> r = Rouge155()

Traceback (most recent call last):

File "<pyshell#1>", line 1, in <module>

r = Rouge155()

File "C:\Python34\lib\site-packages\pyrouge\Rouge155.py", line 88, in        
__init__
self.__set_rouge_dir(rouge_dir)
File "C:\Python34\lib\site-packages\pyrouge\Rouge155.py", line 402, in _   
_set_rouge_dir
self._home_dir = self.__get_rouge_home_dir_from_settings()
File "C:\Python34\lib\site-packages\pyrouge\Rouge155.py", line 418, in 
__get_rouge_home_dir_from_settings
config.read_file(f)
File "C:\Python34\lib\configparser.py", line 691, in read_file
self._read(f, source)
File "C:\Python34\lib\configparser.py", line 1058, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'C:\\Users\\sara\\AppData\\Roaming\\pyrouge\\settings.ini', line: 5
'<!DOCTYPE html>\n'

我在以下位置找到了“pyrough_set_rouge_path/absolute/path/to/rouge-1.5.5/directory”: https://pypi.python.org/pypi/pyrouge/0.1.0


Tags: pathinfrompyselfreadlibdir
2条回答

本杰明海因泽林帮助了我,他的解决方案奏效了。而不是 r=Rouge155() 使用 r=Rouge155('C://RELEASE-1.5.5') 而C://RELEASE-1.5.5是ROUGE-1.5.5的路径,我的是C://RELEASE-1.5.5

必须使用Rouge155 instance作为第一个参数调用unbound方法output_to_dict()(改为获取instancemethod实例)

相关问题 更多 >