问题描述
通过 sudo pip-python
安装软件包(CentOS 6软件包: python-pip-0.8-1.el6.noarch
),我有时得到的安装包的权限问题只有根可读。
When installing a package via sudo pip-python
(CentOS 6 package: python-pip-0.8-1.el6.noarch
), I sometimes get permission issues with the installed packages being readable only by root.
重新安装一次或两次通常修复问题。有没有人经历过这个?
Re-installing again one or two times usually fixes the problem. Has anyone experienced this? Or can anyone suggest any troubleshooting steps to nail down the cause?
推荐答案
使用运行命令时, sudo
,它将保留用户 umask
。 pip
只是安装文件,它不会改变访问权限,所以你的文件的访问权限设置符合当前用户的umask,这可能是
When you run a command using sudo
, it will preserve the users umask
. pip
just installs files, it doesn't change access rights, so you'll end up with the files having the access rights set conforming to the current user's umask, which may be owner-readable only (0077) and therefore readable by root only.
这意味着您可以将umask设置为像 umask 0022
,然后运行 sudo pip install
。或者使用 sudo su
以默认设置打开根shell,然后 pip install
。
That means you can set umask to something sensible like umask 0022
before running sudo pip install
. Or use sudo su
to open a root shell with default settings and then pip install
.
这篇关于pip:不一致的权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!