【问题标题】:pip + why pip removing the current version while we not identify the option force-reinstallpip + 为什么 pip 删除当前版本,而我们没有识别选项 force-reinstall
【发布时间】:2020-10-12 13:58:34
【问题描述】:

我正在安装以下 python 模块

pip install ipaddress-1.0.23-py2.py3-none-any.whl

pip 失败

Processing ipaddress-1.0.23-py2.py3-none-any.whl
Installing collected packages: ipaddress
  Attempting uninstall: ipaddress
    Found existing installation: ipaddress 1.0.16
ERROR: Cannot uninstall 'ipaddress'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

这里不清楚为什么 pip 试图卸载当前的 pkg - ipaddress 1.0.16

众所周知,我们没有使用--force-reinstall选项

那么为什么pip install 会删除当前的- ipaddress 1.0.16 呢?

参考 - Difference between pip install options "ignore-installed" and "force-reinstall"

【问题讨论】:

  • 你使用什么pip 版本?
  • 21版本,从8升级后
  • 你是直接从一个wheel文件安装,这实际上和pip install ipaddress==1.0.23一样。当前安装的ipaddress 版本不符合此要求,因此pip 尝试卸载它,给您带来无法卸载“旧且无法管理”包的著名错误。您可以通过发出pip install ipaddress --find-links=.(假设. 包含wheel 文件)来放宽要求,这不会安装任何内容。或者将pip降级到9.0,卸载ipaddress并从wheel重新安装新版本。
  • 现在,我用了----ignore-installed选项,安装成功了,你有什么意见吗?
  • 与链接答案中的想法相同 - --ignore-installed 不会卸载,只会覆盖文件。根据之前安装 ipaddress 的方式,站点中可能仍有剩余的 1.0.16。试试pip uninstall -y ipaddress 然后pip show ipaddress,你会得到什么?

标签: python python-2.7 pip rhel


【解决方案1】:

尝试运行:

sudo pip install ipaddress==1.0.23 --ignore-installed

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-08
    • 1970-01-01
    • 2017-03-28
    • 2014-05-17
    • 2022-06-30
    • 2020-09-23
    • 2019-10-22
    相关资源
    最近更新 更多