2016-08-24 200 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安裝聊天機器人