简体   繁体   English

使用apt安装的Pip包进行更新/卸载(反之亦然)

[英]Update/uninstall with Pip packages installed with apt (and vice versa)

There are a number of resources that compare and contrast the advantages and disadvantages of using apt-get and pip to install, update, and uninstall python packages. 有许多资源可以比较和对比使用apt-getpip安装,更新和卸载python软件包的优缺点。

What I cannot find is a resource that indicates what happens if something that is installed by one package manager is updated or uninstalled by the other. 我找不到的资源是指示如果一个包管理器安装的内容被另一个包管理器更新或卸载的情况下会发生什么。

When I run pip list , it lists a lot of packages that are installed, most of which on my system were installed by apt-get and not pip . 当我运行pip list ,它列出了很多已安装的软件包,其中大多数在我的系统上是通过apt-get而非pip安装的。

So, are these two package managers able to manage packages installed by the other? 那么,这两个软件包管理器是否能够管理另一个软件包管理器? Or, is pip able to manage a package installed by apt-get , but then apt-get is messed up afterwards. 或者, pip能够管理apt-get安装的软件包,但之后apt-get就会混乱。 Is apt-get able to manage a package installed by pip ? apt-get能够管理pip安装的软件包吗?

I would recommend to try and avoid using two (or more) package managers at the same time. 我建议尝试避免同时使用两个(或更多)程序包管理器。 It's not very likely that they will cooperate correctly and smoothly. 他们不太可能正确,顺利地合作。

If possible, pick one of them and use it. 如果可能,请选择其中之一并使用。 Combine them only if you really need to. 仅在确实需要时将它们组合。 Usually you don't. 通常你不会。

There are ways of avoiding conflicts such as 有避免冲突的方法,例如

  • pip install --user <package> which installs the package into the user's directory only pip install --user <package>仅将软件包安装到用户目录中
  • virtualenv which allows you to have packages installed per application/project - this is a very good idea since various projects might need different versions of the same package and it's easy to move such project do a different computer etc. virtualenv ,它允许您为每个应用程序/项目安装软件包-这是一个好主意,因为各种项目可能需要同一软件包的不同版本,并且很容易将此类项目移动到其他计算机上。
  • venv - Python 3 has a built-in support for virtual environments venv -Python 3具有对虚拟环境的内置支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM