官方提供的arxiv_latex_cleaner的编码格式是有问题的,见这里。这个有位朋友说需要改成utf-8,但是还是报错
File "D:\Env\anaconda\envs\arxiv_clean\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 706: invalid start byte
原因是我的windows电脑采用的是ISO-8859-1编码,所以需要对代码做如下修改
def _read_file_content(filename):
with open(filename, 'r', encoding='ISO-8859-1') as fp:
lines = fp.readlines()
lines = _strip_tex_contents(lines, '\\end{document}')
return lines
修改完成后再安装