无法在 Anaconda 中安装聊天机器人

1 python anaconda python-3.7 chatterbot

使用 Python 3.7 在 Anaconda 中安装时,chatterbot出现以下错误:

找到现有安装:PyYAML 3.13 无法卸载“PyYAML”。这是一个 distutils 安装项目,因此我们无法准确确定哪些文件属于它,这将导致仅部分卸载。

ars*_*sho 6

在使用Python 3.7的环境chatterbot中安装conda

\n\n
    \n
  • conda使用Python 3.7创建新环境
  • \n
\n\n
conda create --name chatterbot_example python=3.7\n
Run Code Online (Sandbox Code Playgroud)\n\n
    \n
  • 激活环境:
  • \n
\n\n
source activate chatterbot_example\n
Run Code Online (Sandbox Code Playgroud)\n\n
    \n
  • 安装chatterbotchatterbot-corpus进入环境:
  • \n
\n\n
pip install chatterbot\npip install chatterbot-corpus\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n
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?"))\n
Run Code Online (Sandbox Code Playgroud)\n\n
    \n
  • 运行程序:
  • \n
\n\n
python example.py\n
Run Code Online (Sandbox Code Playgroud)\n\n

输出:

\n\n
python 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\n
Run Code Online (Sandbox Code Playgroud)\n\n

系统信息:

\n\n
    \n
  • 操作系统:Ubuntu 16.04 LTS
  • \n
  • 处理器:Intel\xc2\xae Core\xe2\x84\xa2 i7-4600M
  • \n
\n\n

Conda版本信息:

\n\n
conda --version\nconda 4.5.11\n
Run Code Online (Sandbox Code Playgroud)\n\n

已安装的软件包:

\n\n
attrs==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\n
Run Code Online (Sandbox Code Playgroud)\n