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:<
The problem here arises from the fact that you have downloaded, compiled and installed a (newer) version of python3, on a machine that has an older python3 installed by the package manager. The latter has and associated pip3 the former does not. You can verify this by doing /usr/local/bin/python3 --version and /usr/bin/python3 --version
Because of that, what happens when you do pip3 install pyyaml is to add the PyYAML package to the old Python3. When you do:
/usr/bin/python3 env/common_config/add_imagepullsecret.py
things should work, unless you rely on some feature of the newer python3.
A more structural solution is to install pip for the newer python3 and use that to install PyYAML.
A more structural solution, is to never install such additional python3 in your path, but e.g. in /opt/python/3.7.0, use virtualenv -p /opt/python/3.7.0/bin/python /opt/util/yourutil, install every package with
/opt/util/yourutil/bin/pip3 install package_name and then do:
/opt/util/yourutil/bin/python env/common_config/add_imagepullsecret.py
to run your program. With a few supporting scripts/functions/aliases/links, this can be done very efficiently without polluting the systempython3` "install space" nor your PATH.