首页 > 解决方案 > python 3.4.4中的langdetect库导入错误

问题描述

我在 python 3.4.4 中导入了“langdetect”库。这在 python 3.4.4 shell 中成功运行,但是当我创建一个新的 .py 文件时,它无法成功运行。它表明 ImportError: cannot import name 'detect'。我如何解决这个问题。

标签: python

解决方案


看起来您已经命名了自己的文件langdetect.py,然后尝试将import langdetect. 这使它尝试导入自己。将您的文件重命名为其他名称,例如testdetect.py.


推荐阅读