python - 如何为 Python 安装 yaml 包?

标签 python python-2.7 yaml pip pyyaml

我有一个使用 YAML 的 Python 程序。我尝试使用 pip install yaml 在新服务器上安装它,它返回以下内容:

$ sudo pip install yaml
Downloading/unpacking yaml
  Could not find any downloads that satisfy the requirement yaml
No distributions at all found for yaml
Storing complete log in /home/pa/.pip/pip.log

如何为 Python 安装 yaml 包?我正在运行 Python 2.7。 (操作系统:Debian Wheezy)

最佳答案

你可以试试pip的搜索功能,

$ pip search yaml

在简短描述中使用 yaml 在 PyPI 中查找包。这揭示了各种包,包括 PyYaml、yamltools 和 PySyck 等(注意 PySyck docs 建议使用 PyYaml,因为 syck 已过时)。现在你知道了一个特定的包名,你可以安装它:

$ pip install pyyaml

如果你想在 linux 系统范围内安装 python yaml,你也可以使用包管理器,如 aptitudeyum:

$ sudo apt-get install python-yaml
$ sudo yum install python-yaml

关于python - 如何为 Python 安装 yaml 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14261614/

相关文章:

Python:else内部的while循环

python-2.7 - 了解 Python 中一行中的多个变量赋值

ruby - 将值插入到 YAML 转储的哈希中

python - 无法在 Google Colab 中使用 bash 运行 Starspace

python - 在tensorflow 2中找不到Tensorflow模块,在哪里可以找到新方法的文档?

python-3.x - python 3.6解释器中没有名为 `numpy`的模块

python - 通过将列表索引视为python中的键,将dict中的所有列表转换为dict

java - 我应该在 java 中读取或解析 YAML 文件吗

python - 尝试创建 Kubernetes 作业时出错

python - 转换/旋转 DataFrame 实例