Python packages with conflicting dependencies

前端 未结 2 677
无人及你
无人及你 2021-01-20 03:32

we are trying to install several own written python3 applications sharing some libraries with conflicting versions.

We are currently discussing employing the order o

相关标签:
2条回答
  • 2021-01-20 03:53

    You can use pipx.

    pipx will do all the work of setting up separate virtual environments for each application, so that all the applications' dependencies remain separate.

    If you use virtualenv yourself, you have to switch environments to run a different application. pipx handles the environment for you, so you don't have to mess with the virtualenvs at all.

    From the docs:

    pipx is made specifically for application installation, as it adds isolation yet still makes the apps available in your shell: pipx creates an isolated environment for each application and its associated packages.

    Old Answer (pipsi is no longer maintained, but pipx is almost identical in usage)

    You can use pipsi.

    pipsi will do all the work of setting up separate virtual environments for each application, so that all the applications' dependencies remain separate.

    If you use virtualenv yourself, you have to switch environments to run a different application. pipsi handles the environment for you, so you don't have to mess with the virtualenvs at all.

    From the docs:

    If you are installing Python packages globally for cli access, you almost certainly want to use pipsi instead of running sudo pip .... so that you get

    • Isolated dependencies to guarantee no version conflicts
    • The ability to install packages globally without using sudo
    • The ability to uninstall a package and its dependencies without affecting other globally installed Python programs
    0 讨论(0)
  • 2021-01-20 03:54

    For dependency isolation and management I always have one virtualenv per application. This prevents issues with inter-application dependency conflicts and if there are dependency conflicts within an application's dependency any hackery to workaround them is limited to the affected environment.

    Also, dependency upgrades can be performed independently per application.

    0 讨论(0)
提交回复
热议问题