【发布时间】:2014-01-24 21:10:57
【问题描述】:
我按照这里的说明...
https://github.com/ahupp/python-magic#dependencies
我运行了 pip install python-magic 并且安装没有任何问题。然后我安装了 cygwin 并将 C:\cygwin\bin 添加到我的系统路径中。当我在 Windows 命令提示符下运行 python 解释器并导入魔法时,我得到了这个错误......
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import magic
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\magic.py", line 161, in <module>
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation
>>>
我错过了一步吗?
【问题讨论】:
-
您是否将 cygwin1.dll、cygz.dll 和 cygmagic-1.dll 复制到 C:\Windows\System32?如果您没有在 Cygwin 中运行 Python,则可能需要这样做。
-
@MattDMo:事实上,它在文档中明确指出,就在他链接的部分……
-
@abarnert - 对。我只是问,因为 OP 没有在问题中明确提到它。
-
@MattDMo:是的,这就是我为你的评论 +1 的原因。
标签: python python-magic