ImportError:没有名为'Kernel'的模块

时间:2015-11-28 12:51:29

标签: python window kernel chatbot aiml

我正在使用Windows 10并正在使用chatbot项目并使用与python集成的aiml 我收到了这个错误

import aiml
File"C:\Python34\lib\site-packages\aiml\__init__.py", line 4, in <module>  
from Kernel import Kernel  
ImportError: No module named 'Kernel'

在此处运行集成代码时

 import aiml

    # Create the kernel and learn AIML files 
      kernel = aiml.Kernel() 
      kernel.learn("std-startup.xml") 
      kernel.respond("load aiml b")    
    # Press CTRL-C to break this loop while True:
      print (kernel.respond(raw_input("Enter your message >> ")))

和我的aiml目录包含file__init__.py 这是它的内容

__all__ = []

# The Kernel class is the only class most implementations should need. 
  from Kernel import Kernel

还有文件内核存在..那么问题是什么?

2 个答案:

答案 0 :(得分:3)

我已经查看了代码并在本地测试了它,aiml模块似乎目前不支持Python 3,但在Python 2.7中加载完全正常。

安装Python 2.7,事情应该对你有好处。

答案 1 :(得分:2)

尝试安装python-aiml

  pip install python-aiml

这是一个更新的版本,因此应该可以正常工作。