与此问题相同,但标题不正确。而且,症状比这篇文章中解释的更令人讨厌。
从Ubuntu 14.04升级到16.04-Pip显示在活动虚拟环境中安装的软件包,即使关闭了venv也是如此。
此外,在安装软件包pip时会引发以下错误:
The directory '/home/user/.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/user/.cache/pip' or its parent directory is not owned by the
current user and caching wheels has been disabled. check the
permissions and owner of that directory. If executing pip with sudo,
you may want sudo's -H flag.
做的时候我也得到一个权限错误pip install <package_name>
我能解决这个问题有pip install --user <package_name>
。并且,sudo仅与上述-H
选项一起工作。
对这个错误有任何见解或可能的解决方案将是非常棒的!提前致谢!
埃德
我找到了问题的答案。发生这种情况是因为Virtualenv是使用sudo安装的,并且pip / .cache文件归用户所有。那里有些软件包将需要访问sudo。以下是有关该问题的信息和参考。我在此错误的解释下方添加了一个白痴指南。
可以在这里阅读更多信息https://pip.pypa.io/en/stable/user_guide/#user-installs。
我的修复
删除了〜/ user / .cache中的所有项目包。哪个安装位置“错误” pip uninstall -r <path_to_project_requirements.txt>
(需要时使用sudo NB前缀)。
删除了virtualenv sudo pip uninstall virtualenv
使用以下命令安装virtualenv pip --user install virtualenv
。这将停止所有权问题。并且,不必使用sudo在全球范围内安装它,您也可以使用virtualenv包装器,这可能会为您省去一些麻烦,但我不是...
创建您的项目目录:mkdir <project>
并进入它cd project
。
virtualenv venv
创建本地环境文件夹以将软件包安装到 . venv/bin/activate
继续安装您的项目要求。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句