【问题标题】:rarfile library installation exceptionrarfile 库安装异常
【发布时间】:2013-09-10 06:04:00
【问题描述】:

我用 Activepython 安装了 rarfile 库(我正在使用 mac os 和 eclipse),虽然everyhting 似乎已正确安装,但我仍然通过简单的提取测试继续收到此错误消息:

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile.py", line 1843, in custom_popen
    raise RarExecError("Unrar not installed? (rarfile.UNRAR_TOOL=%r)" % UNRAR_TOOL)
rarfile.RarExecError: Unrar not installed? (rarfile.UNRAR_TOOL='unrar')

我检查了 rarfile 库在我的计算机上的安装位置,并使用以下路径在 Eclipse(Window -> Preferences -> Pydev -> Interpreter - Python -> System PYTHONPATH)的包含文件中定义了库路径:

/Bibliothèque/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile-2.6-py2.7.egg-info

/Bibliothèque/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile.py

/Bibliothèque/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile.pyc

/Bibliothèque/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile.pyo

我仍然收到此错误消息:

File "/Users/moi/Documents/workspace/Apprentissage/Dezipper/test_rarfile_2.py", line 3, in <module>
    ref.extractall('/Users/moi/Downloads/_zips/rars/')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile.py", line 675, in extractall
    self._extract(fnlist, path, pwd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile.py", line 1202, in _extract
    p = custom_popen(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rarfile.py", line 1843, in custom_popen
    raise RarExecError("Unrar not installed? (rarfile.UNRAR_TOOL=%r)" % UNRAR_TOOL)
rarfile.RarExecError: Unrar not installed? (rarfile.UNRAR_TOOL='unrar')

你知道这个问题吗?非常感谢。

【问题讨论】:

    标签: python eclipse python-2.7


    【解决方案1】:

    好的,我解决了这个问题。 除了在 python 中安装 rarfile 库之外,我还需要安装 unrar 库。在 mac os x 上,这可以通过在终端中执行此操作:

    cd /tmp
    curl -o output.tar.gz http://www.rarlab.com/rar/rarosx-3.9.3.tar.gz
    Untar the tar ball, enter:
    
    tar -zxvf output.tar.gz
    

    现在,rar 已提取,我不再收到错误消息。很高兴知道。

    【讨论】:

      猜你喜欢
      • 2014-12-11
      • 1970-01-01
      • 1970-01-01
      • 2020-09-25
      • 2021-10-29
      • 2014-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多