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



我正在尝试安装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('rn', '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学习

确保已安装依赖项。从源代码安装需要安装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

这样你就不会有任何错误。

相关内容

  • 没有找到相关文章