1

我正在尝试使用官方指南在我的 Mac 中安装 Chatterbot:http: //chatterbot.readthedocs.io/en/stable/setup.html

因此,当我尝试查看官方指南显示的模块版本时出现错误。

➜  chatterbot git:(master) python --version
Python 2.7.10

➜  chatterbot git:(master) pip install chatterbot
Requirement already satisfied: chatterbot in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: python-twitter<4.0.0,>=3.0.0 in /usr/local/lib/python2.7/site-packages (from chatterbot)
Requirement already satisfied: nltk<4.0.0,>=3.2.0 in /usr/local/lib/python2.7/site-packages (from chatterbot)
Requirement already satisfied: chatterbot-corpus<1.0.0,>=0.0.1 in /usr/local/lib/python2.7/site-packages (from chatterbot)
Requirement already satisfied: pymongo<4.0.0,>=3.3.0 in /usr/local/lib/python2.7/site-packages (from chatterbot)
Requirement already satisfied: jsondatabase<1.0.0,>=0.1.7 in /usr/local/lib/python2.7/site-packages (from chatterbot)
Requirement already satisfied: future in /usr/local/lib/python2.7/site-packages (from python-twitter<4.0.0,>=3.0.0->chatterbot)
Requirement already satisfied: requests-oauthlib in /usr/local/lib/python2.7/site-packages (from python-twitter<4.0.0,>=3.0.0->chatterbot)
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages (from python-twitter<4.0.0,>=3.0.0->chatterbot)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from nltk<4.0.0,>=3.2.0->chatterbot)
Requirement already satisfied: oauthlib>=0.6.2 in /usr/local/lib/python2.7/site-packages (from requests-oauthlib->python-twitter<4.0.0,>=3.0.0->chatterbot)

➜  ~ python -m chatterbot --version
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Library/Python/2.7/site-packages/chatterbot/__main__.py", line 8, in <module>
    print(chatterbot.__version__)
AttributeError: 'module' object has no attribute '__version__'

我尝试使用 pip 和源代码进行安装。

有什么办法解决这个问题吗?

4

1 回答 1

0

我这将产生一个版本号

import chatterbot
chatterbot.__version__

结果类似这样的基于安装的聊天机器人版本

'0.6.2'

即使建议没有奏效,也要尝试

点安装聊天机器人

如果是 Linux 风格的尝试

sudo pip install chatterbot

于 2017-06-22T09:06:44.727 回答