尝试运行pyroug时出错

2024-06-26 11:01:15 发布

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

我已经按照官方网站上的说明安装了pyrouge。在

https://pypi.python.org/pypi/pyrouge

但是当我尝试运行“python-m”时,出现了以下错误烟火试验““

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pyrouge_convert_plain_text_to_rouge_format", line 4, in <module>
    __import__('pkg_resources').run_script('pyrouge==0.1.3', 'pyrouge_convert_plain_text_to_rouge_format')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 743, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1490, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'pyrouge_convert_plain_text_to_rouge_format'
EEEETraceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pyrouge_evaluate_plain_text_files", line 4, in <module>
    __import__('pkg_resources').run_script('pyrouge==0.1.3', 'pyrouge_evaluate_plain_text_files')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 743, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1490, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'pyrouge_evaluate_plain_text_files'
EEEEE
======================================================================
ERROR: test_config_file (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 138, in test_config_file
    rouge = Rouge155()
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 88, in __init__
    self.__set_rouge_dir(rouge_dir)
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 407, in __set_rouge_dir
    self.data_dir = os.path.join(self._home_dir, 'data')
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 543, in fset
    verify_dir(path, dir_name)
  File "/Library/Python/2.7/site-packages/pyrouge/utils/file_utils.py", line 87, in verify_dir
    raise Exception(msg)
Exception: Cannot set data directory because the path /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrouge/data does not exist.

======================================================================
ERROR: test_convert_summaries (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 126, in test_convert_summaries
    check_output(command.split())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '[u'pyrouge_convert_plain_text_to_rouge_format', u'-i', u'data/SL2003_models_plain_text', u'-o', u'/tmp/tmps6qLvp']' returned non-zero exit status 1

======================================================================
ERROR: test_evaluation (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 151, in test_evaluation
    rouge = Rouge155()
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 88, in __init__
    self.__set_rouge_dir(rouge_dir)
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 407, in __set_rouge_dir
    self.data_dir = os.path.join(self._home_dir, 'data')
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 543, in fset
    verify_dir(path, dir_name)
  File "/Library/Python/2.7/site-packages/pyrouge/utils/file_utils.py", line 87, in verify_dir
    raise Exception(msg)
Exception: Cannot set data directory because the path /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrouge/data does not exist.

======================================================================
ERROR: test_options (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 203, in test_options
    rouge = Rouge155()
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 88, in __init__
    self.__set_rouge_dir(rouge_dir)
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 407, in __set_rouge_dir
    self.data_dir = os.path.join(self._home_dir, 'data')
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 543, in fset
    verify_dir(path, dir_name)
  File "/Library/Python/2.7/site-packages/pyrouge/utils/file_utils.py", line 87, in verify_dir
    raise Exception(msg)
Exception: Cannot set data directory because the path /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrouge/data does not exist.

======================================================================
ERROR: test_paths (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 23, in test_paths
    rouge = Rouge155()
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 88, in __init__
    self.__set_rouge_dir(rouge_dir)
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 407, in __set_rouge_dir
    self.data_dir = os.path.join(self._home_dir, 'data')
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 543, in fset
    verify_dir(path, dir_name)
  File "/Library/Python/2.7/site-packages/pyrouge/utils/file_utils.py", line 87, in verify_dir
    raise Exception(msg)
Exception: Cannot set data directory because the path /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrouge/data does not exist.

======================================================================
ERROR: test_rouge_for_plain_text (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 173, in test_rouge_for_plain_text
    pyrouge_output = check_output_clean(pyrouge_command.split())
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 17, in <lambda>
    check_output_clean = lambda c: check_output(c).decode("UTF-8").strip()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '[u'pyrouge_evaluate_plain_text_files', u'-m', u'data/models_plain', u'-s', u'data/systems_plain', u'-sfp', u'D(\\d+).M.100.T.A', u'-mfp', u'D#ID#.M.100.T.[A-Z]', u'-id', u'1']' returned non-zero exit status 1

======================================================================
ERROR: test_text_conversion (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 91, in test_text_conversion
    rouge = Rouge155()
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 88, in __init__
    self.__set_rouge_dir(rouge_dir)
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 407, in __set_rouge_dir
    self.data_dir = os.path.join(self._home_dir, 'data')
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 543, in fset
    verify_dir(path, dir_name)
  File "/Library/Python/2.7/site-packages/pyrouge/utils/file_utils.py", line 87, in verify_dir
    raise Exception(msg)
Exception: Cannot set data directory because the path /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrouge/data does not exist.

======================================================================
ERROR: test_write_config (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 197, in test_write_config
    check_output(command.split())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test_wrong_model_pattern (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 73, in test_wrong_model_pattern
    rouge = Rouge155()
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 88, in __init__
    self.__set_rouge_dir(rouge_dir)
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 407, in __set_rouge_dir
    self.data_dir = os.path.join(self._home_dir, 'data')
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 543, in fset
    verify_dir(path, dir_name)
  File "/Library/Python/2.7/site-packages/pyrouge/utils/file_utils.py", line 87, in verify_dir
    raise Exception(msg)
Exception: Cannot set data directory because the path /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrouge/data does not exist.

======================================================================
ERROR: test_wrong_system_pattern (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pyrouge/tests/Rouge155_test.py", line 59, in test_wrong_system_pattern
    rouge = Rouge155()
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 88, in __init__
    self.__set_rouge_dir(rouge_dir)
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 407, in __set_rouge_dir
    self.data_dir = os.path.join(self._home_dir, 'data')
  File "/Library/Python/2.7/site-packages/pyrouge/Rouge155.py", line 543, in fset
    verify_dir(path, dir_name)
  File "/Library/Python/2.7/site-packages/pyrouge/utils/file_utils.py", line 87, in verify_dir
    raise Exception(msg)
Exception: Cannot set data directory because the path /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyrouge/data does not exist.

----------------------------------------------------------------------
Ran 10 tests in 0.403s

FAILED (errors=10)

我只在sudo模式下运行命令。我不知道他们说的“pyrouge_set_rouge_path/absolute/path/to/rouge-1.5.5/directory”是什么意思。这是否意味着我需要设置/提供pyrouge的安装路径作为环境变量?python和path是如何为我们设定的。在

我真的被困在这里了,请帮帮我。在


Tags: pathinpytestselfdatapackagesdir