依赖项冲突的Python软件包 [英] Python packages with conflicting dependencies

查看:264
本文介绍了依赖项冲突的Python软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试安装几个自己编写的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,但pipx的用法几乎相同)

您可以使用 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 running sudo pip .... so that you get

  • 隔离的依赖项以确保没有版本冲突
  • 无需使用sudo即可全局安装软件包的功能
  • 在不影响软件包的情况下卸载软件包及其依赖项的能力 其他全局安装的Python程序
  • 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

这篇关于依赖项冲突的Python软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆