ImportError: No module named 'yaml'

Neeraj picture Neeraj · Jun 15, 2018 · Viewed 88.5k times · Source

I have one script in which I am trying to execute

python3 env/common_config/add_imagepullsecret.py

But, I am getting the following error:

 [root@kevin]# python3 env/common_config/add_imagepullsecret.py
 Traceback (most recent call last):
 File "env/common_config/add_imagepullsecret.py", line 4, in <module>
 import yaml
 ImportError: No module named 'yaml'
 [root@kevin]# pip3 install pyyaml
 Requirement already satisfied: pyyaml in /usr/lib64/python3.4/site-packages 
 (3.12)
 [root@kevin]#

PyYAML is already installed in the machine:

 [root@bhimsvm31 k8s]# pip3 install pyyaml
 Requirement already satisfied: pyyaml in /usr/lib64/python3.4/site-packages 
 (3.12)
 [root@bhimsvm31 k8s]#

How can I get this script to import PyYAML?

Answer

illusionx picture illusionx · Jul 11, 2019
pip install pyyaml

This should serve the purpose