pip install boilerpipe failed with tarfile.ReadError: empty file

pip install boilerpipe failed with tarfile.ReadError: empty file

我尝试通过 pip 安装 boilerpipe 但失败了。

这是日志。

命令的完整输出 python setup.py egg_info:

Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "/tmp/pip-build-J2gFYC/boilerpipe/setup.py", line 27, in <module>
    download_jars(datapath=DATAPATH)
  File "/tmp/pip-build-J2gFYC/boilerpipe/setup.py", line 21, in download_jars
    tar = tarfile.open(tgz_name, mode='r:gz')
  File "/usr/lib/python2.7/tarfile.py", line 1678, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/usr/lib/python2.7/tarfile.py", line 1727, in gzopen
    **kwargs)
  File "/usr/lib/python2.7/tarfile.py", line 1705, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/usr/lib/python2.7/tarfile.py", line 1574, in __init__
    self.firstmember = self.next()
  File "/usr/lib/python2.7/tarfile.py", line 2334, in next
    raise ReadError("empty file")
tarfile.ReadError: empty file

----------------------------------------

命令 "python setup.py egg_info" 在 /tmp/pip-build-J2gFYC/boilerpipe

中失败,错误代码为 1

有时应该从 URL 下载 GZ 文件 returns 404。在这种情况下安装 boilerpipe 的最佳方法是:

  • git clone https://github.com/ptwobrussell/python-boilerpipe.git
  • 打开setup.py
  • 找到定义 link 的行。通常,这条线看起来像 tgz_url = 'https://boilerpipe.googlecode.com/files/boilerpipe-{0}-bin.tar.gz'.format(version)
  • https://code.google.com/archive/p/boilerpipe/downloads
  • 中找到有效的下载 link
  • 将其更改为包含有效的 URL tgz_url='https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/boilerpipe/boilerpipe-1.2.0-bin.tar.gz'