undefined symbol: PyUnicodeUCS4_AsUTF8String解决办法

Centos 错误提示

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

/usr/lib/python2.7/site-packages/rpm/_rpm.so: undefined symbol: PyUnicodeUCS4_AsUTF8String

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.7.12 (default, Feb 21 2020, 16:46:36)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq

解决办法:

export PATH=$PYTHONPATH/bin:$PATH
export LD_LIBRARY_PATH=$PYTHONHOME/lib:$LD_LIBRARY_PATH