2

我正在使用 Windows 10 并正在处理一个聊天机器人项目并使用与 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 >> ")))

我的目标目录包含文件__init__.py 这是它的内容

__all__ = []

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

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

4

2 回答 2

3

尝试安装 python-aiml

  pip install python-aiml

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

于 2020-03-24T16:59:30.193 回答
3

我查看了代码并在本地对其进行了测试,该aiml模块目前似乎不支持 Python 3,但在 Python 2.7 中加载得非常好。

安装Python 2.7,你的工作应该会更好。

于 2015-11-28T12:57:42.723 回答