如何为 Python 安装 yaml 包? [英] How do I install the yaml package for Python?

查看:45
本文介绍了如何为 Python 安装 yaml 包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a Python program that uses YAML. I attempted to install it on a new server using pip install yaml and it returns the following:

$ 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)

How do I install the yaml package for Python? I'm running Python 2.7. (OS: Debian Wheezy)

推荐答案

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

You could try the search feature in pip,

$ pip search yaml

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

which looks for packages in PyPI with yaml in the short description. That reveals various packages, including PyYaml, yamltools, and PySyck, among others (Note that PySyck docs recommend using PyYaml, since syck is out of date). Now you know a specific package name, you can install it:

$ pip install pyyaml

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

If you want to install python yaml system-wide in linux, you can also use a package manager, like aptitude or yum:

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

这篇关于如何为 Python 安装 yaml 包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆