我不成功地尝试安装一个python模块与sudo和用户www-data .我在/var/www/html/文件夹执行此操作.下面是我使用的代码和我得到的错误.我的状态,我已经有权限执行此文件夹中的文件,因为我已经激活了它.该错误仅适用于PIP.谢谢建议.
使用的命令:sudo -H -u www-data pip install --user package_name
错误类型:ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/var/www/.local' Check the permissions.
个
我也收到这个警告:WARNING: The directory '/var/www/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
个
但有问题的文件夹(.local和.cache/pip)在该路径中不存在!
我试着做sudo chown -R www-data /var/www/.cache/pip
但路径不存在!
1条答案
按热度按时间zqry0prt1#
在/var/www中设置director.local和.cache
第一个月
sudo mkdir /var/www/.cache
个将其所有权更改为www-data
sudo chown www-data:www-data /var/www/.local
sudo chown www-data:www-data /var/www/.cache
个现在使用pip作为www-data
sudo -H -u www-data pip install package_name
安装模块