提前原谅我的无知,我对python很陌生。我正在尝试在 3.4.2 中使用 Mingus 库 ( https://code.google.com/r/artdent-mingus-python3/ ) 的 python 3 版本 ( https://pypi.python.org/pypi/mingus/ )。尝试使用 note 模块时,我不断收到标题中列出的 ImportError。
根据我对类似 ImportError 问题的研究,我尝试了以下操作: - 我确保相关目录中有一个 mt_exceptions.py 文件 -我确保站点包目录中的每个 mingus 目录都有 init.py 文件 -我删除了mingus目录下的.pyc文件
关于我下一步可能尝试什么的任何指示?
最佳答案
我通过手动输入“C:\Python34\Lib\site-packages\mingus\core”并编辑文件解决了这个问题(在我的例子中,我不得不从 编辑 notes.py)从 mt_exceptions import NoteFormatError, RangeError, FormatError" 到 "from mingus.core.mt_exceptions import NoteFormatError, RangeError, FormatError",然后我得到了在 3 上运行的典型 Python 2.x。 x 字典错误。这就是问题所在!
解决方案:使用 Python 2.x,or update the whole schmere to 3.x (这就是我正在做的)。
As you can see here , Python 3.x 稍微改变了导入语法,这就是正在发生的事情。我必须通过所有 mingus 源代码运行 2to3 并从所有文件手动修复导入(基本上,将整个东西移植到 Python 3.x)。
关于python - 导入错误:使用 Mingus 库时没有名为 'mt_exceptions' 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26984731/