pip install: 请检查该目录的权限和所有者 [英] pip install: Please check the permissions and owner of that directory
问题描述
在安装 pip 和 python 时,我遇到了一个说:
While installing pip and python I have ran into a that says:
目录/Users/Parthenon/Library/Logs/pi"或其父目录不属于当前用户所有并且调试日志已被禁用.请检查该目录的权限和所有者.如果使用 sudo 执行 pip,您可能需要 -H 标志.
The directory '/Users/Parthenon/Library/Logs/pi' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
因为我现在必须使用 sudo
进行安装.
because I now have to install using sudo
.
我的 Mac 上已经安装了 python 和一些库,我正在运行 Yosemite.我最近不得不彻底擦拭,然后重新安装操作系统.现在我收到了这个提示,但我无法弄清楚如何更改它
I had python and a handful of libraries already installed on my Mac, I'm running Yosemite. I recently had to do a clean wipe and then reinstall of the OS. Now I'm getting this prompt and I'm having trouble figuring out how to change it
以前我的命令行是 Parthenon$
现在是 Philips-MBP:~ Parthenon$
Before my command line was Parthenon$
now it's Philips-MBP:~ Parthenon$
我是这台计算机的唯一所有者,这是它的唯一帐户.升级到 python 3.4 时,这似乎是一个问题,似乎没有什么地方是正确的,virtualenv 没有去我期望的地方,等等.
I am the sole owner of this computer and this is the only account on it. This seems to be a problem when upgrading to python 3.4, nothing seems to be in the right place, virtualenv isn't going where I expect it to, etc.
推荐答案
当我从运行 pip
到 sudo pip
时,我在 Mac 上也看到了这个变化.将 -H
添加到 sudo 会导致消息消失.例如
I also saw this change on my Mac when I went from running pip
to sudo pip
. Adding -H
to sudo causes the message to go away for me. E.g.
sudo -H pip install foo
man sudo
告诉我 -H
导致 sudo
将 $HOME
设置为目标用户(root在这种情况下).
man sudo
tells me that -H
causes sudo
to set $HOME
to the target users (root in this case).
所以看起来 pip 正在查看 $HOME/Library/Log
并且 sudo
默认没有将 $HOME
设置为 /root/
.毫不奇怪 ~/Library/Log
由您作为用户而不是 root 拥有.
So it appears pip is looking into $HOME/Library/Log
and sudo
by default isn't setting $HOME
to /root/
. Not surprisingly ~/Library/Log
is owned by you as a user rather than root.
我怀疑这是 pip 最近的一些变化.现在我将使用 sudo -H
运行它以解决问题.
I suspect this is some recent change in pip. I'll run it with sudo -H
for now to work around.
这篇关于pip install: 请检查该目录的权限和所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!