python - pip 安装 : Please check the permissions and

在安装 pip 和 python 时,我遇到了一个说:

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 进行安装。

我的 Mac 上已经安装了 python 和一些库,我正在运行 Yosemite。我最近不得不做一个干净的删除,然后重新安装操作系统。现在我收到此提示,但我无法弄清楚如何更改它

之前我的命令行是 Parthenon$ 现在是 Philips-MBP:~ Parthenon$

我是这台计算机的唯一所有者,并且这是它的唯一帐户。升级到 python 3.4 时这似乎是一个问题,似乎没有什么在正确的地方,virtualenv 没有按照我的预期进行,等等。

最佳答案

当我从运行 pipsudo pip 时,我也在我的 Mac 上看到了这种变化。将 -H 添加到 sudo 会导致消息消失。例如

sudo -H pip install foo

man sudo 告诉我 -H 导致 sudo$HOME 设置为目标用户(root在这种情况下)。

所以看起来 pip 正在查看 $HOME/Library/Log 并且默认情况下 sudo 没有将 $HOME 设置为 /root/.毫不奇怪,~/Library/Log 归您所有,而不是 root。

我怀疑这是 pip 最近的一些变化。我暂时用 sudo -H 运行它。

关于python - pip 安装 : Please check the permissions and owner of that directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27870003/

相关文章:

linux - cd进入目录没有权限

linux - 带有 -i 选项的 sed 命令(就地编辑)在 Ubuntu 上运行良好,但在 Ma

http - Wget 将文档和标题输出到 STDOUT

python - 如何将 SqlAlchemy 结果序列化为 JSON?

python - 在python中跳过for循环的第一个条目?

linux - 如何计算包括子目录在内的代码行数

python - glob.glob() 的返回值是如何排序的?

python - 导入错误 : No module named PIL

linux - 什么 linux shell 命令返回字符串的一部分?

linux - 如何获取 Linux/UNIX 上当前的网络接口(interface)吞吐量统计信息