PermissionError: [Errno 13] Permission denied: 'Pipfile' for pipenv install requests

前端 未结 2 774
借酒劲吻你
借酒劲吻你 2021-01-06 09:58

I\'m trying to follow this guide on pipenv and virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/ . The problem is, I run into a problem when trying to

2条回答
  •  独厮守ぢ
    2021-01-06 10:41

    I had the same symptoms:

    with open(path, 'w') as f:
    PermissionError: [Errno 13] Permission denied: 'Pipfile'
    

    the problem was that I had a Pipfile in one of the parent directories and with different permissions (in my case, created by root while experimenting). Deleting this Pipfile resolved the issue. The same issue is discussed Pipenv issue.

    More details: when trying to install/create a new virtual environment, pipenv looks into all the parent directories to see if there already is a Pipfile in there. If there is a Pipfile, and was created with different permissions (e.g. under root via sudo in my case), pipenv will not have permissions to write to this Pipfile, creating a somewhat unclear error message.

    A tell tale sing is that pipenv --where prints a different directory name than you'd expect (or prints a directory path when you're just creating a new environment instead of "No pipfile present at project home...")

提交回复
热议问题