我们正在尝试安装几个自己编写的 python3 应用程序,它们共享一些版本冲突的库.
we are trying to install several own written python3 applications sharing some libraries with conflicting versions.
我们目前正在讨论在 PYTHONPATH 和/或 pythons virtualenv 中使用包的顺序.
We are currently discussing employing the order of packages inside the PYTHONPATH and/ or pythons virtualenv.
你会怎么处理?
你可以使用pipx.
pipx 将为每个应用程序设置单独的虚拟环境,以便所有应用程序的依赖项保持独立.
pipx will do all the work of setting up separate virtual environments for each application, so that all the applications' dependencies remain separate.
如果您自己使用 virtualenv,则必须切换环境以运行不同的应用程序.pipx 为您处理环境,因此您根本不必弄乱 virtualenvs.
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.
来自文档:
pipx 专为应用程序安装而设计,因为它增加了隔离性,但仍使应用程序在您的 shell 中可用:pipx 为每个应用程序及其关联的包创建一个隔离的环境.
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.
您可以使用 pipsi.
pipsi 将为每个应用程序设置单独的虚拟环境,以便所有应用程序的依赖项保持独立.
pipsi will do all the work of setting up separate virtual environments for each application, so that all the applications' dependencies remain separate.
如果您自己使用 virtualenv,则必须切换环境以运行不同的应用程序.pipsi 为您处理环境,因此您根本不必弄乱 virtualenvs.
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.
来自文档:
如果您要全局安装 Python 包以进行 cli 访问,您几乎可以肯定要使用 pipsi
而不是运行 sudo pip ....
所以你得到的
If you are installing Python packages globally for cli access, you almost certainly want to use
pipsi
instead of runningsudo pip ....
so that you get
这篇关于具有冲突依赖项的 Python 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!