【问题标题】:ImportError (libmagic) when using eyed3 module使用 eyed3 模块时的 ImportError (libmagic)
【发布时间】:2019-05-27 18:45:47
【问题描述】:

我是 Python 新手,正在尝试使用 eyed3 模块。这是我的代码。

import eyed3

def GetAlbumName(filename):
    tag = eyed3.tag()

我遇到了异常

Exception has occurred: ImportError failed to find libmagic

如以下链接所述,我安装了“python-magic”,但异常仍然存在。 pip installing eyeD3 module. Failed to find libmagic

在 Visual Studio Code 中,我尝试更改解释器 (Ctrl+Shift+P),但这也无济于事

【问题讨论】:

  • 您使用的是什么操作系统?有时 libmagic 需要特定的 .whl 文件,具体取决于您的操作系统。

标签: python python-3.x eyed3 libmagic


【解决方案1】:

在 Windows 上

运行 pip install python-magic-bin 为 libmagic 导入所需的 DLL。


在 OSX 上

如果您使用的是自制软件,请运行 brew install libmagic;如果您使用的是 macport,请运行 port install file


它都包含在 python-magic repo https://github.com/ahupp/python-magic 的安装部分中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-21
    • 2021-04-16
    • 2020-12-21
    • 2016-03-09
    • 2015-08-04
    • 2017-01-28
    • 1970-01-01
    相关资源
    最近更新 更多