2016-05-13 60 views
2

我試圖安裝由 http://scikit-learn.org/stable/install.html 但最後得到這個錯誤錯誤:無法創建「/usr/local/lib/python2.7/dist-packages/sklearn」:權限被拒絕

scikit學習以下
creating /usr/local/lib/python2.7/dist-packages/sklearn 

error: could not create '/usr/local/lib/python2.7/dist-packages/sklearn': Permission denied 

---------------------------------------- 
    Can't roll back scikit-learn; was not uninstalled 
Cleaning up... 
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_tauqeer/scikit-learn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-i5vTnt-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_tauqeer/scikit-learn 
Traceback (most recent call last): 
    File "/usr/bin/pip", line 9, in <module> 
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')() 
    File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main 
    return command.main(cmd_args) 
    File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main 
    text = '\n'.join(complete_log) 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 48: ordinal not in range(128) 

我自己也嘗試pip install scikit-learn,它顯示

Requirement already satisfied (use --upgrade to upgrade): scikit-learn in /usr/lib/python2.7/dist-packages 
Cleaning up... 

我也嘗試過使用

sudo apt-get install scikit-learn 
通過嘗試

我得到這個

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package scikit-learn

+0

是否「sudo pip install scikit-learn」?你不能apt-get scikit學習,這是一個蟒蛇包 –

+1

,這對我的作品感謝 –

回答

1

確保已安裝的依賴。從源代碼安裝要求您已經安裝了scikit學習運行時依賴

可以使用

sudo apt-get install build-essential python-dev python-setuptools \ 
        python-numpy python-scipy \ 
        libatlas-dev libatlas3gf-base 

然後使用下面的命令來安裝

pip install --user --install-option="--prefix=" -u scikit-learn 

那麼你不會得到任何錯誤安裝它們。

相關問題