ImportError: No module named 'Kernel'

2019-08-12 19:08发布

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条回答
乱世女痞
2楼-- · 2019-08-12 19:14

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.

查看更多
登录 后发表回答