我尝试使用官方指南在我的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和源代码安装。
有什么想法解决这个问题吗?
答案 0 :(得分:0)
我将生成版本号
import chatterbot
chatterbot.__version__
这样的结果是基于安装的聊天机器人版本
'0.6.2'
即使建议没有奏效,也要尝试
pip install chatterbot
如果是Linux风味尝试
sudo pip install chatterbot