python - pip 不会使用 --user 在本地安装 Python 包

标签 python package pip easy-install pythonpath

我正在尝试使用 pip 在本地安装软件包。它曾经与 --user 一起使用,但现在当我尝试它时,它会在 /usr/local/lib/ 中找到包的版本,然后不安装它本地。通常它会在 ~/.local 中安装东西,但现在它只是检查包的系统范围目录,如果它在那里,它不会安装它(这不是我想要的)并且如果它不在那里,它试图将它安装在我没有写入权限的 /usr/local/lib 中。例如:

$ pip install --user rpy2
Requirement already satisfied (use --upgrade to upgrade): rpy2 in /usr/local/lib/python2.7/dist-packages/

如何使 pip install --user 始终转到 ~/.local 而不是系统范围的目录?

最佳答案

Citing Marcus Smith(pip 的维护者):

If you think the global site is out of date, and want the latest in the user site, then use:
pip install --upgrade --user SomePackage

If the global site is up to date, and you really just want the same thing duplicated in --user, then use:
pip install --ignore-installed --user SomePackage (which works correctly now after the merge of #1352, which is to be released in v1.5)

如何让 pip install --user 始终转到 ~/.local 而不是系统范围的目录?

同时使用 --upgrade--ignore-installed 参数。

关于python - pip 不会使用 --user 在本地安装 Python 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15418949/

相关文章:

python - Pylint 使用 Windows 和 Python 3.2 安装问题

Python如何将文件与模板匹配

python:exchangelib:RHEL 6:GLIBC_2.14 问题

python - 蛇和苹果不对齐

lisp - 从 cl-user 包导入

go - 拉取单个go标准包的副本进行修改

python - 正则表达式 - 抓取带有句点 1.1、1.1.1 等的部分

actionscript-3 - 包名称与 getter 和 setter 冲突?

python - 为什么即使已经安装了 Scrapy 模块,python 也会抛出 "ImportError: No module named linkextractor"?

python-2.7 - 如何使用python2.7在64位Windows 10机器上安装lxml