如何解决传递依赖冲突问题?

Far*_*rah 5 python dependencies python-3.x pandas pipenv

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

我需要更新版本的pandas. 所以我安装成功:

pipenv install pandas~=1.0
Run Code Online (Sandbox Code Playgroud)

然后我安装了 Apache Beam:

pipenv install apache-beam[gcp,test]
Run Code Online (Sandbox Code Playgroud)

这安装了 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.
Run Code Online (Sandbox Code Playgroud)

它将我的pandas版本降级到0.24.2不支持我需要的东西。

我该如何解决这个问题?

谢谢

小智 0

尝试手动安装:

  1. 将 pandas 升级回 1.0

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

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

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

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

C:\Users\<user>\AppData\Local\Programs\Python\Python<version>\Lib\site-packages
Run Code Online (Sandbox Code Playgroud)

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

C:\Users\<user>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8\LocalCache\local-packages\Python38\site-packages
Run Code Online (Sandbox Code Playgroud)