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

时间:2020-06-12 08:14:23

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

我使用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,这不支持我需要的功能。

如何解决此问题?

谢谢

2 个答案:

答案 0 :(得分:0)

尝试手动安装:

  1. 将熊猫升级到1.0

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

  3. 安装所需的其他模块

  4. 将文件夹粘贴回modules文件夹中

如果您是从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

答案 1 :(得分:0)

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

    /**
     * @Route("/admin/{slug}/{action}/{id}", name="{slug}_{action}")
     */
  public function delete(CourtsRepository $courtsRepository,
                           DomainsRepository $domainsRepository,
                           Request $request, $slug, $action, $id)
    {
        /*
         *  Get the repos for edit or delete update
         *  Check if the action is edit to get the execute query
         */
        switch ($slug) {
            case 'courts':
                $repos = $this->getDoctrine()->getRepository(Courts::class);
                $form = ($action == "edit") ? $this->createForm(ACategoriesFormType::class, $courtsRepository->find($id)) : false;
                break;
            case 'domains':
                $repos = $this->getDoctrine()->getRepository(Domains::class);
                $form = ($action == "edit") ? $this->createForm(ACategoriesFormType::class, $domainsRepository->find($id)): false;
                break;
            default:
                // will redirect to admin page if user try to bypass by url with bad slug
                return $this->redirectToRoute('admin');
                break;
        }
   }

看看以后是否可以安装它。

如果出现错误,请尝试:

$ pipenv lock --pre --clear