Open In App

How to Install PyYAML on Windows?

Last Updated : 25 Apr, 2022
Like Article

YAML is a data serialization format that enables interaction with scripts. It is generally used to create configuration files, as it prioritizes human readability, and is therefore preferred over JSON. PyYAML is a tool that parses and emits YAML for Python. It has many useful features, like an API for low-level event-based parsing and emitting and full Unicode support, etc. It supports YAML tags and some python specific tags that allow representing Python arbitrary objects. In this article, we will learn how to install PyYAML in Windows.


A Windows computer with installations of:

Steps to Install PyYAML

To install PyYAML in Windows follow the following steps:

Step 1: Open Windows Terminal as Administrator.



Step 2: Now, in the windows terminal write the following command to check if Python 3.5 + is installed or not.

python –version

Checking-the version-of-Python


The output should be of the form: Python 3.x.y, where x > 5. If you get a different output, the correct version of Python is not installed in your system. So now you can install the latest version of Python in your system.

Step 3: Check if pip is installed or not. PIP is a tool that enables developers to install python packages (like PyYAML). Typically, PIP is automatically installed with Python. To verify if PIP is installed in the system, open the Windows Terminal with the steps mentioned prior, and type the following command:

pip –version


If the output is not of the following format:

pip x.y.z from <location>

Then, PIP is not installed on your system. So now you can install PIP in your system. 

Step 4: Installing PyYAML. Open the Windows Terminal as outlined before, and type the following command:

pip install PyYAML



Verifying the installation of PyYAML

Now, open the Windows Terminal again, open the Python Shell, and try importing the PyYAML shell to verify whether the PyYAML is properly installed or not. If you import PyYAML with any error then that means PyYAML is installed properly in your system.


>>> import yaml



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads