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

前端 未结 8 1525
独厮守ぢ
独厮守ぢ 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条回答
  •  猫巷女王i
    2020-11-21 22:49

    Just clarifying what worked for me after much pain in linux (ubuntu based) on permission denied errors, and leveraging from Bert's answer above, I now use ...

    $ pip install --user 
    

    or if running pip on a requirements file ...

    $ pip install --user -r requirements.txt
    

    and these work reliably for every pip install including creating virtual environments.

    However, the cleanest solution in my further experience has been to install python-virtualenv and virtualenvwrapper with sudo apt-get install at the system level.

    Then, inside virtual environments, use pip install without the --user flag AND without sudo. Much cleaner, safer, and easier overall.

提交回复
热议问题