红联Linux门户
Linux帮助

pip,python,ubuntu,linux,..sudo导致失败问题(sudo -H)

发布时间:2016-09-01 14:17:16来源:linux网站作者:2347329662_B_Z_Y_W_B
安装requests库,之前使用:pip install requests
结果没有sudo,导致失败
后面加了 sudo pipinstall requests
却提示失败,无法collect......
 
The directory '/home/bzy/.cache/pip/http' or its parentdirectory is not owned by the current user and the cache has beendisabled. Please check the permissions and owner of that directory.If executing pip with sudo, you may want sudo's -H flag.
Retrying (Retry(total=4, connect=None, read=None,redirect=None)) after connection broken by'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org',port=443): Read timed out. (read timeout=15)",)':/simple/requests/
 
最后仔细看了下:
sudo pipinstall requests
的报错信息,才知道要加上 -H
sudo -H pip installrequests
这样就好了。
 
-H, --set-home
Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry.  Depending on the policy,this may be the default behavior.
-H 将环境变数中的 HOME(家目录)指定为要变更身份的使用者家目录(如不加 -u 参数就是系统管理者 root )
 
本文永久更新地址:http://www.linuxdiyf.com/linux/23803.html