【发布时间】:2017-03-17 08:21:27
【问题描述】:
我以usera 登录。我正在尝试从我的主目录运行带有sudo 的脚本,并从pip 为另一个用户(即newuser)安装一些包。
在script.sh 我有以下内容:
sudo -u newuser pip3 install virtualenv
所以我输入为usera 的命令看起来像~/.usera: sudo script.sh
由于某种原因,这给了我以下错误:
PermissionError: [Errno 13] Permission denied: '/home/usera/.local'
The directory '/home/usera/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
而且它没有安装,至少没有正确安装。有什么办法可以做到吗?
【问题讨论】: