我使用 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')
对这个问题有任何想法吗?非常感谢。