Wednesday, March 21, 2018

pip install's error. IOError: [Errno 13] Permission denied

When I tried to update pip, I got this error:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip/wheel.pyc'

But, if I use sudo, it seems to be using another directory of pip because it says the pip version is already the latest.
$ sudo pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python3.5/dist-packages

In that case, just add "--user" option, then you can install or upgrade successfully.
$ pip install --upgrade --user pip

Collecting pip
  Using cached pip-9.0.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.2