Python3 模块

Python3 模块

我最近安装了 Ubuntu 14.04,并且已经成为 Python 爱好者好几年了,因为我在研究生院使用 Python 进行(文本)数据分析。

我注意到 14.04 附带了 Python 2.7 和 Python 3.4。但是,存储库只安装了 Python 2.7 的 Python 模块。我想知道当默认“python”给出 Python 2.7 时,是否有人可以指导我安装 Python 3.4(特别是 numpy 和 matplotlib)模块的步骤。

谢谢。不必急着回答。

答案1

正如 bain 指出的那样,您会发现 python3.x 模块的前缀为python3-<pkgname>。您可以通过搜索包缓存(其中包括可用和未安装的包)来查看这一点。

以下是几个相关的命令:

apt-cache search numpy | egrep ^python3  # search for numpy, python3
apt-cache search -n ^python3             # search only package names for python3

表达式^python3限制为以“python3”开头的包,而“-n”将搜索限制为名称(而不是长描述)。您可以删除这些以进行更常规的搜索。

以下是一些示例输出:

$ apt-cache search numpy | egrep ^python3
python3-numpy - Fast array facility to the Python 3 language
python3-numpy-dbg - Fast array facility to the Python 3 language (debug extension)
python3-h5py - h5py is a general-purpose Python interface to hdf5
python3-mpi4py - bindings of the Message Passing Interface (MPI) standard
python3-mpi4py-dbg - bindings of the MPI standard -- debug symbols
python3-numexpr - Fast numerical array expression evaluator for Python 3 and NumPy
python3-numexpr-dbg - Fast numerical array expression evaluator for Python 3 and NumPy (debug ext)
python3-pyproj - Python 3 interface to PROJ.4 library
python3-scipy - scientific tools for Python 3
python3-scipy-dbg - scientific tools for Python 3 - debugging symbols
python3-tables - hierarchical database for Python3 based on HDF5
python3-tables-dbg - hierarchical database for Python 3 based on HDF5 (debug extension)
python3-tables-lib - hierarchical database for Python3 based on HDF5 (extension)


$ apt-cache search -n ^python3
python3 - interactive high-level object-oriented language (default python3 version)
python3-all - package depending on all supported Python 3 runtime versions
python3-all-dbg - package depending on all supported Python 3 debugging packages
python3-all-dev - package depending on all supported Python 3 development packages
python3-amqp - Low-level AMQP client (Python3 version)
python3-apparmor - AppArmor Python3 utility library
python3-apparmor-click - Click manifest to AppArmor easyprof conversion tools
python3-apport - Python 3 library for Apport crash report handling
python3-apt - Python 3 interface to libapt-pkg
python3-apt-dbg - Python 3 interface to libapt-pkg (debug extension)
python3-aptdaemon - Python 3 m[...]

答案2

Python 3 软件包以“python3”为前缀。对于 numpy 和 matplotlib,请安装python3-numpypython3-matplotlib

相关内容