https://github.com/google-research/arxiv-latex-cleaner/issues/24
文章目录
注意:需要创建python==3.9的环境
1.修改编码
官方提供的arxiv_latex_cleaner的编码格式是有问题的,见这里。这个有位朋友说需要改成utf-8,但是还是报错
            
            
              bash
              
              
            
          
            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编码,所以需要对代码做如下修改
            
            
              python
              
              
            
          
          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修改完成后再安装
2.如何安装
2.1.打包
            
            
              bash
              
              
            
          
          tar -zcvf 给打包的文件起个名字呗.tar.gz   文件包在的目录比如:tar -zcvf arxiv-latex-cleaner.tar.gz arxiv-latex-cleaner
2.2.安装
            
            
              bash
              
              
            
          
          pip install /path/to/package.tar.gz3.测试功能
直接cd到指定的.tex目录下
            
            
              bash
              
              
            
          
          arxiv_latex_cleaner ./