python - 在 Fedora 中使用 pip 或 dnf 安装 python 包?

标签 python pip fedora yum dnf

我在Fedora中安装一些python包时,有两种方式:

  • 使用dnf安装python-package
  • 使用pip安装包

我注意到我什至使用 dnf update 使我的 Fedora 成为最新的, 当我使用 pip 时,它仍然会告诉我类似

pip is a old version, please use pip update

我猜 dnf 包管理与 python-pip 包管理不同。

那么安装python包比较推荐哪个呢?

最佳答案

引自Gentoo Wiki :

It is important to understand that packages installed using pip will not be tracked by Portage. This is the case for installing any package through means other than the emerge command. Possible conflicts can be created when installing a Python package that is available in the Portage tree, then installing the same package using pip.

Decide which package manager will work best for the use case: either use emerge or pip for Python packages, but not both. Sometimes a certain Python packages will not be available in the Portage tree, in these cases the only option is to use pip. Be wise and make good choices!

当今几乎所有的包管理器都是如此。如果您使用的包或某些包版本仅存在于 pip 中,请使用它,但不要尝试dnf 安装它。这样做不仅会导致文件冲突,而且(很可能)会破坏包管理器对系统的了解,这通常会导致重大的包管理问题。

其他解决方案是在用户模式下使用 pip,无需 root 权限,这会将相关内容安装到您的主目录中。

所以,再次强调,使用 pip dnf 都可以,但不要将这两个包管理器混合在一起。

关于python - 在 Fedora 中使用 pip 或 dnf 安装 python 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33584734/

相关文章:

python - Django 数据表和枚举

python - 在 Flycheck 中使用正确的 virtualenv 和 flake8 配置

python - 使用 Emacs 进行 Django 调试

python - 'pip install <package>' 和 'python -m pip install <package>' 有什么区别?

linux - 可以为每个 http 请求分配一个新的 IP 地址吗?

Python正则表达式忽略日期模式

python - Heroku 未能满足安装 pip 要求

python - pip安装m2crypto错误

linux - Fedora arm - Orange Pi plus 2e

hadoop - 使用 chmod 安装 hadoop