【问题标题】:How to fix transitive dependencies conflict issue?如何解决传递依赖冲突问题?
【发布时间】:2020-10-02 00:45:55
【问题描述】:

我使用pipenv 命令在我的 Python 虚拟环境中安装包。

我需要更新版本的pandas。于是我就安装成功了:

pipenv install pandas~=1.0

然后我安装了 Apache Beam:

pipenv install apache-beam[gcp,test]

这安装了 Apache Beam,但给了我一个错误:

[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.

  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches pandas<0.25,>=0.23.4,~=1.0
...
There are incompatible versions in the resolved dependencies.

它把我的pandas 版本降级为0.24.2,它不支持我需要的东西。

我该如何解决这个问题?

谢谢

【问题讨论】:

    标签: python python-3.x pandas dependencies pipenv


    【解决方案1】:

    尝试手动安装:

    1. 将 pandas 升级回 1.0

    2. 复制 pandas 文件夹和 pandas-dist 文件夹

    3. 安装您需要的其他模块

    4. 将文件夹粘贴回模块文件夹中

    如果你是从 python 网站下载的,你的模块文件夹应该在这里

    C:\Users\<user>\AppData\Local\Programs\Python\Python<version>\Lib\site-packages
    

    如果您是从 Microsoft 商店下载的,请点击此处

    C:\Users\<user>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8\LocalCache\local-packages\Python38\site-packages
    

    【讨论】:

      【解决方案2】:

      尝试通过运行清除锁定文件中的缓存:

      $ pipenv lock --pre --clear
      

      看看以后能不能安装。

      如果报错,试试:

      $ pipenv lock --clear
      

      【讨论】:

        猜你喜欢
        • 2017-09-10
        • 1970-01-01
        • 1970-01-01
        • 2015-08-26
        • 2016-02-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-01-01
        相关资源
        最近更新 更多