pip安装:请检查该目录的权限和所有者

pip安装:请检查该目录的权限和所有者

问题描述:

在安装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.

我怀疑这是最近的点差变化.我现在用sudo -H运行它.

I suspect this is some recent change in pip. I'll run it with sudo -H for now to work around.