python-2.7 - sudo pip install 的权限警告

标签 python-2.7 pip

我使用的是 ubuntu 14.04 64 位机器。系统python是2.7.6。 这就是当我尝试 pip install 任何东西时发生的情况

thekindlyone@deepthought:~$ sudo pip install pyopenssl
The directory '/home/thekindlyone/.cache/pip/log' 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 sudo's -H flag.
The directory '/home/thekindlyone/.cache/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 sudo's -H flag.
The directory '/home/thekindlyone/.cache/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 sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): pyopenssl in /usr/lib/python2.7/dist-packages

pip 版本为 6.1.1 我如何摆脱这些警告?

最佳答案

也许您想使用 sudo '-H' 选项将 HOME 环境变量设置为目标用户的密码数据库条目指定的主目录。

这样,pip 将使用 root 用户主目录中的缓存目录。

例如。

$ sudo -H pip install pyopenssl

关于python-2.7 - sudo pip install 的权限警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29968070/

相关文章:

python - 无法安装 csv 模块

python - 操纵 Blackjack 中 A 的值(Python)

python - 无法通过在 python 3.4 上运行的 pip 安装模块

python - 在 ubuntu 14.04 上安装 Pillow 时出错

python - TensorFlow 安装错误,未启用 Windows LongPath 支持

python - 在 ubuntu 16.04 中安装 pip 后出现错误 "/usr/bin/python3.9: bad interpreter: No such file or directory"

python - python 2.7 中的 ConfigParser VS SafeConfigParser

python - 通过startproject创建Scrapy项目时出错

python - 如何读取当前QTabWidget选项卡的QTextEdit文本?

python - 安装 simplejson 后没有名为 'json' 的模块