ImportError: No module named 'Kernel'

删除回忆录丶 提交于 2019-12-11 12:52:04

问题


I'm using windows 10 and working on a chatbot project and use aiml integrated with python I got this error

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

when running the integration code here

 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 >> ")))

and my aiml directory contains the file__init__.py here's it's content

__all__ = []

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

also file Kernel exists .. so what is the problem ?


回答1:


I've had a look at the code and tested it locally, and the aiml module seemingly does not currently support Python 3, but loads perfectly fine in Python 2.7.

Install Python 2.7 and things should work a lot better for you.



来源:https://stackoverflow.com/questions/33971517/importerror-no-module-named-kernel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!