错误:无法创建'/usr/local/lib/python2.7/dist-packages/sklearn':权限被拒绝

时间:2016-05-13 06:43:03

标签: python-2.7 scikit-learn svm

我正在尝试安装以下scikit学习 http://scikit-learn.org/stable/install.html 但最终得到这个错误

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

尝试sudo我得到了这个

  

阅读包裹清单......完成

     

构建依赖关系树

     

阅读州信息......完成

     

E:无法找到包scikit-learn

1 个答案:

答案 0 :(得分:2)

确保已安装依赖项。从源代码安装需要您安装scikit-learn运行时依赖项

您可以使用

安装它们
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

然后你不会得到任何错误。