所以这是我第一次尝试安装 Django,当我运行它时,它成功安装了 Django-1.7.3,但我收到了以下警告。我无法在网上找到有关它的任何信息,所以我希望有人能澄清它们的意思,如果我需要修复它们,以及我该如何去做?
谢谢!下面是我终端的输出
macbook:~ Asif$ sudo pip install Django
Password:
The directory '/Users/Asif/Library/Logs/pip' 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.
The directory '/Users/Asif/Library/Caches/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 the -H flag.
The directory '/Users/Asif/Library/Caches/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 the -H flag.
Collecting Django
Downloading Django-1.7.3-py2.py3-none-any.whl (7.4MB)
100% |################################| 7.4MB 2.3MB/s
Installing collected packages: Django
Successfully installed Django-1.7.3
最佳答案
这些消息只是告诉您,在发出 sudo
之后,当前用户已更改为 root
而 root
不是那些用户的所有者目录或父目录之一。
sudo -H
将 $HOME
环境变量设置为 /root
并且可能会隐藏这些,但您这样做的方式非常好.
我很确定这些消息没有什么值得担心的,但看到人们阅读并确定它们总是很高兴。
此外,要验证这一 pip ,您可以尝试:
$ sudo env | less
和
$ sudo -H env | less
并注意 $HOME 和 $USER 变量
关于python - sudo pip 安装 django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28004960/