在 Debian 9 上安装基于 python 的软件包的规则
install rule of python based packages on Debian 9
为了在 Debian 9 中安装 matplotlib,我应该发布
sudo apt-get install python3-matplotlib
或
pip3 install matplotlib?
首选方式是什么?让我添加更多细节。
'man pip3' 说
pip is a Python package installer, recommended for installing Python
packages which are not available in the Debian archive.
matplotlib 证实了这一点
To install Matplotlib at the system-level, we recommend that you use
your distribution's package manager. This will guarantee that
Matplotlib's dependencies will be installed as well.
据此我将运行 apt-get。但是,我在 numpy 中遇到了类似的情况。 'import numpy' 在 'pip3 install numpy' 之后工作。
正在使用
Debian GNU/Linux 9.6(延伸)
$ python3 -V
Python 3.5.3
man pip3
的关键引述是:
recommended for installing Python packages which are not available in the Debian archive.
您可以通过发出 apt search
命令来检查 Debian 档案库中是否有可用的软件包,例如
apt search matplotlib
如果您的系统已经具备所有必要的依赖项,那么使用 pip
安装软件包就可以了(正如您使用 pip install numpy
所体验的那样)。
如果您没有必要的依赖项,您的发行版的包管理器将自动安装它们。但是,pip
并非如此:您需要手动解决任何依赖性问题。对于 matplotlib,您可以找到您需要 install manually here.
的依赖项列表
从本质上讲,使用系统包管理器安装包可以省去确保您拥有该包的所有必要依赖项的额外工作。
如果您想使用虚拟环境,pip
就派上用场了。
为了在 Debian 9 中安装 matplotlib,我应该发布
sudo apt-get install python3-matplotlib
或
pip3 install matplotlib?
首选方式是什么?让我添加更多细节。
'man pip3' 说
pip is a Python package installer, recommended for installing Python packages which are not available in the Debian archive.
matplotlib 证实了这一点
To install Matplotlib at the system-level, we recommend that you use your distribution's package manager. This will guarantee that Matplotlib's dependencies will be installed as well.
据此我将运行 apt-get。但是,我在 numpy 中遇到了类似的情况。 'import numpy' 在 'pip3 install numpy' 之后工作。
正在使用 Debian GNU/Linux 9.6(延伸)
$ python3 -V
Python 3.5.3
man pip3
的关键引述是:
recommended for installing Python packages which are not available in the Debian archive.
您可以通过发出 apt search
命令来检查 Debian 档案库中是否有可用的软件包,例如
apt search matplotlib
如果您的系统已经具备所有必要的依赖项,那么使用 pip
安装软件包就可以了(正如您使用 pip install numpy
所体验的那样)。
如果您没有必要的依赖项,您的发行版的包管理器将自动安装它们。但是,pip
并非如此:您需要手动解决任何依赖性问题。对于 matplotlib,您可以找到您需要 install manually here.
从本质上讲,使用系统包管理器安装包可以省去确保您拥有该包的所有必要依赖项的额外工作。
如果您想使用虚拟环境,pip
就派上用场了。