[我正在使用conda python 3.6.9进行AI Chatbot项目。我收到以下错误。如何解决以下错误?

问题描述 投票:0回答:1

我正在使用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> pythonmain.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行,在导入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导入add_arg_scope作为contrib_add_arg_scope ModuleNotFoundError:未命名模块'tensorflow.contrib

python tensorflow tflearn
1个回答
0
投票

卸载最新的tensorflow,它没有-contrib模块。

pip uninstall tensorflow

然后,尝试此旧版本。

pip install tensorflow==1.13.2
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.