python - sudo pip 安装 django

标签 python django pip

所以这是我第一次尝试安装 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 之后,当前用户已更改为 rootroot 不是那些用户的所有者目录或父目录之一。

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/

相关文章:

python - 值错误: could not convert string to float: '' in Python 3

python - boxlayout中的文本左对齐

python - 查询集过滤器 : retrieve manytomany field as list of each object

python - Django:如何获取模型继承的模型?

Python TA-Lib 安装问题

python - DateTimeField 中的 Django 和微秒差异

python - Tornado .httpclient.HTTPError : HTTP 599: Timeout during request

python - Django 'function' 对象没有属性 'objects'

python - mac pip安装mysql-python不成功

linux - 从 .so 文件中删除路径,以便 RPM check-buildroot 成功