How do I install the yaml package for Python?
pip install pyyaml
If you don't have pip, run easy_install pip
to install pip, which is the go-to package installer - Why use pip over easy_install?. If you prefer to stick with easy_install, then easy_install pyyaml
You could try the search feature in pip,
$ pip search yaml
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
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
This answers if for MacOS
Update: Nowadays installing is done with pip, and for many users a wheel may be available (depending on your Mac and required version of PyYaml). In some cases libyaml is still required to build the C extension (on mac); this can be done with:
brew install libyaml
python -m pip install pyyaml
Outdated method:
For MacOSX (mavericks), the following works:
brew install libyaml
sudo python -m easy_install pyyaml