pip install failing with: OSError: [Errno 13] Permission denied on directory

前端 未结 8 1462
独厮守ぢ
独厮守ぢ 2020-11-21 22:43

pip install -r requirements.txt fails with the exception below OSError: [Errno 13] Permission denied: \'/usr/local/lib/.... What\'s wrong and how d

相关标签:
8条回答
  • 2020-11-21 23:13

    So, I got this same exact error for a completely different reason. Due to a totally separate, but known Homebrew + pip bug, I had followed this workaround listed on Google Cloud's help docs, where you create a .pydistutils.cfg file in your home directory. This file has special config that you're only supposed to use for your install of certain libraries. I should have removed that disutils.cfg file after installing the packages, but I forgot to do so. So the fix for me was actually just...

    rm ~/.pydistutils.cfg.

    And then everything worked as normal. Of course, if you have some config in that file for a real reason, then you won't want to just straight rm that file. But in case anyone else did that workaround, and forgot to remove that file, this did the trick for me!

    0 讨论(0)
  • 2020-11-21 23:13

    It is due permission problem,

    sudo chown -R $USER /path to your python installed directory
    

    default it would be /usr/local/lib/python2.7/

    or try,

    pip install --user -r package_name
    

    and then say, pip install -r requirements.txt this will install inside your env

    dont say, sudo pip install -r requirements.txt this is will install into arbitrary python path.

    0 讨论(0)
提交回复
热议问题