2016-08-24 140 views
0

我试图安装模块“聊天机器人0.4.6”,但它失败,出现以下错误:聊天机器人:安装

Exception: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run 
    prefix=options.prefix_path, 
    File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 742, in install 
    **kwargs 
    File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 831, in install 
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
    File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1032, in move_wheel_files 
    isolated=self.isolated, 
    File "/Library/Python/2.7/site-packages/pip/wheel.py", line 346, in move_wheel_files 
    clobber(source, lib_dir, True) 
    File "/Library/Python/2.7/site-packages/pip/wheel.py", line 317, in clobber 
    ensure_dir(destdir) 
    File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir 
    os.makedirs(path) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs 
    mkdir(name, mode) 
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/nltk' 

什么可能会造成这种情况发生?

+1

莫非你请澄清命令您使用安装包?似乎有一个权限问题。你有你的电脑的管理员权限吗? – Ascurion

+0

我用sudo命令解决了它:sudo pip install chatterbot。现在还有另一个问题。在安装结束时,在shell中,Python无法识别模块。但安装成功安装:收集chatterbot ...成功安装chatterbot-0.4.6 future-0.15.2 fuzzywuzzy-0.11.1 jsondatabase-0.1.1 nltk-3.2.1 oauthlib-1.1.2 pymongo-3.3.0 python -twitter-3.1 requests-oauthlib-0.6.2 textblob-0.11.1 – Adryr83

+0

你是什么意思由Python不能识别模块? – Ascurion

回答

1

正如@ Adryr83所正确推荐的那样,在安装与pip的Python包时,linux平台通常需要sudo命令。

例如:

sudo pip install chatterbot

+1

如果您没有sudo权限,请尝试使用python虚拟环境,这里提供更多信息http://python-guide-pt-br.readthedocs.io/en/latest/dev/virtualenvs/ –

0

试试这个须藤PIP3安装聊天机器人