无法在Ubuntu 16.04上安装pip

时间:2018-07-24 18:55:35

标签: python pip

当我键入:

python get-pip.py
 Collecting pip
  Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
 Collecting wheel
  Using cached https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl
 Installing collected packages: pip, wheel
  Found existing installation: pip 18.0
    Uninstalling pip-18.0:
      Successfully uninstalled pip-18.0
  Rolling back uninstall of pip

显示错误:

 Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip'
 Consider using the `--user` option or check the permissions.

我该怎么办?

1 个答案:

答案 0 :(得分:0)

这是一个权限错误。如果安装程序尝试访问的目录归root所有,则可能需要root用户才能安装pip。出于安全原因,如果您要尝试使用该路由,建议不要使用sudo安装/运行它。

相关:pip install -r: OSError: [Errno 13] Permission denied