1 python anaconda python-3.7 chatterbot
使用 Python 3.7 在 Anaconda 中安装时,chatterbot出现以下错误:
找到现有安装:PyYAML 3.13 无法卸载“PyYAML”。这是一个 distutils 安装项目,因此我们无法准确确定哪些文件属于它,这将导致仅部分卸载。
chatterbot中安装condaconda使用Python 3.7创建新环境conda create --name chatterbot_example python=3.7\nRun Code Online (Sandbox Code Playgroud)\n\nsource activate chatterbot_example\nRun Code Online (Sandbox Code Playgroud)\n\nchatterbot并chatterbot-corpus进入环境:pip install chatterbot\npip install chatterbot-corpus\nRun Code Online (Sandbox Code Playgroud)\n\nexample.py:from chatterbot import ChatBot\nfrom chatterbot.trainers import ChatterBotCorpusTrainer\n\nchatbot = ChatBot(\'Ron Obvious\')\n\n# Create a new trainer for the chatbot\ntrainer = ChatterBotCorpusTrainer(chatbot)\n\n# Train the chatbot based on the english corpus\ntrainer.train("chatterbot.corpus.english")\n\n# Get a response to an input statement\nprint(chatbot.get_response("Hello, how are you today?"))\nRun Code Online (Sandbox Code Playgroud)\n\npython example.py\nRun Code Online (Sandbox Code Playgroud)\n\n输出:
\n\npython example.py\n[nltk_data] Downloading package stopwords to /home/cefalo/nltk_data...\n[nltk_data] Package stopwords is already up-to-date!\n[nltk_data] Downloading package averaged_perceptron_tagger to\n[nltk_data] /home/cefalo/nltk_data...\n[nltk_data] Package averaged_perceptron_tagger is already up-to-\n[nltk_data] date!\nTraining ai.yml: [####################] 100%\nTraining botprofile.yml: [####################] 100%\nTraining computers.yml: [####################] 100%\nTraining conversations.yml: [####################] 100%\nTraining emotion.yml: [####################] 100%\nTraining food.yml: [####################] 100%\nTraining gossip.yml: [####################] 100%\nTraining greetings.yml: [####################] 100%\nTraining health.yml: [####################] 100%\nTraining history.yml: [####################] 100%\nTraining humor.yml: [####################] 100%\nTraining literature.yml: [####################] 100%\nTraining money.yml: [####################] 100%\nTraining movies.yml: [####################] 100%\nTraining politics.yml: [####################] 100%\nTraining psychology.yml: [####################] 100%\nTraining science.yml: [####################] 100%\nTraining sports.yml: [####################] 100%\nTraining trivia.yml: [####################] 100%\nTell me a joke\nRun Code Online (Sandbox Code Playgroud)\n\n系统信息:
\n\nConda版本信息:
\n\nconda --version\nconda 4.5.11\nRun Code Online (Sandbox Code Playgroud)\n\n已安装的软件包:
\n\nattrs==19.1.0\nblis==0.2.4\ncertifi==2019.3.9\nchardet==3.0.4\nChatterBot==1.0.5\nchatterbot-corpus==1.2.0\ncymem==2.0.2\nidna==2.8\njsonschema==3.0.1\nmathparse==0.1.2\nmurmurhash==1.0.2\nnltk==3.4.1\nnumpy==1.16.3\nPint==0.9\nplac==0.9.6\npreshed==2.0.1\npymongo==3.8.0\npyrsistent==0.15.2\npython-dateutil==2.7.5\npytz==2019.1\nPyYAML==3.13\nrequests==2.22.0\nsix==1.12.0\nspacy==2.1.4\nSQLAlchemy==1.2.19\nsrsly==0.0.5\nthinc==7.0.4\ntqdm==4.32.1\nurllib3==1.25.2\nwasabi==0.2.2\nRun Code Online (Sandbox Code Playgroud)\n