pythonpython-2.7yamlpippyyaml

How do I install the yaml package for Python?


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

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


Solution

  • You could try the search the feature on https://pypi.org/search (via a browser) and look 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
    

    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