python - 我正在使用 conda python 3.6.9 开发我的 AI Chatbot 项目。我收到以下错误。如何修复以下错误?
问题描述
我正在使用 python 制作一个 AI 聊天机器人。
我已经安装了所有必需的 pip 包:
import nltk
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()
import numpy
import tflearn
import tensorflow
import random
import json
with open("intents.json") as file:
data = json.load(file)
print(data)
预期的 :
(VCB) C:\Users\Aravind Nallajerla\Desktop\Capstone Project\VCB>python main.py
{
'intents': [{
'tag': 'greeting',
'patterns': ['Hi', 'How are you', 'Is anyone there?', 'Hello', 'Good day', 'Whats up'],
'responses': ['Hello!', 'Good to see you again!', 'Hi there, how can I help?'],
'context_set': ''
}, {
'tag': 'goodbye',
'patterns': ['cya', 'See you later', 'Goodbye', 'I am Leaving', 'Have a Good day'],
'responses': ['Sad to see you go :(', 'Talk to you later', 'Goodbye!'],
'context_set': ''
}, {
'tag': 'age',
'patterns': ['how old', 'how old is tim', 'what is your age', 'how old are you', 'age?'],
'responses': ['I am 18 years old!', '18 years young!'],
'context_set': ''
}, {
'tag': 'name',
'patterns': ['what is your name', 'what should I call you', 'whats your name?'],
'responses': ['You can call me Tim.', "I'm Tim!", "I'm Tim aka Tech With Tim."],
'context_set': ''
}, {
'tag': 'shop',
'patterns': ['Id like to buy something', 'whats on the menu', 'what do you reccommend?', 'could i get something to eat'],
'responses': ['We sell chocolate chip cookies for $2!', 'Cookies are on the menu!'],
'context_set': ''
}, {
'tag': 'hours',
'patterns': ['when are you guys open', 'what are your hours', 'hours of operation'],
'responses': ['We are open 7am-4pm Monday-Friday!'],
'context_set': ''
}]
}
实际的 :
回溯(最后一次调用):文件“main.py”,第 6 行,在 import tflearn 文件“C:\Users\Aravind Nallajerla\AppData\Local\conda\conda\envs\VCB\lib\site-packages\tflearn__init__ .py”,第 4 行,来自 . 导入配置文件“C:\Users\Aravind Nallajerla\AppData\Local\conda\conda\envs\VCB\lib\site-packages\tflearn\config.py”,第 5 行,从 .variables 导入变量文件“C: \Users\Aravind Nallajerla\AppData\Local\conda\conda\envs\VCB\lib\site-packages\tflearn\variables.py",第 7 行,从 tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope ModuleNotFoundError :没有名为“tensorflow.contrib”的模块
解决方案
您必须在终端中安装 tensorflow 模块pip install tensorflow
。
如果 pip 安装有错误,那么尝试更改 python 版本或参考官方错误列表。
推荐阅读
- spring-boot - Spring Boot 和 R2DBC:io.r2dbc.spi.R2dbcNonTransientResourceException:连接验证失败
- angular - Angular 项目 - 将用户输入添加到下拉菜单中
- c++ - 使用某些线程进行矩阵乘法的 MPI 程序的调试断言失败
- python - 读入带有整个标题的 .dat 文件
- javascript - 使用 RLS 嵌入 PowerBI
- jinja2 - 带有 dbt 宏的动态列的雪花“枢轴”
- android - 如何从firebase Android kotlin获取基于userId的数据?
- json - 发生异常,字符 1 处出现意外字符
- python - 如果我有重复的日期,如何用 pandas 中两个日期之间计算的值填充一列?
- python-requests - 如何在绝对链接-for 循环 (requests_html) 中获取项目的 URL