Environment: CENTOS 7
my code:
import six.moves.xmlrpc_client as xmlrpclib
output:
ImportError: No module named xmlrpc_client
python interpreter:
[root@dhcppc0 devstack]# python
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import six
>>> import six.moves
>>> import six.moves.xmlrpc_client
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named xmlrpc_client
>>>
Six version:
[root@dhcppc0 devstack]# sudo yum install python-six
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: centos.mirror.digitalpacific.com.au
* epel: mirror.overthewire.com.au
* extras: centos.mirror.digitalpacific.com.au
* updates: centos.mirror.digitalpacific.com.au
Package python-six-1.9.0-2.el7.noarch already installed and latest version
Nothing to do
XMLRPC version:
[root@dhcppc0 devstack]# sudo yum install xmlrpc-client.noarch
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: centos.mirror.digitalpacific.com.au
* epel: fedora.mirror.serversaustralia.com.au
* extras: centos.mirror.digitalpacific.com.au
* updates: centos.mirror.digitalpacific.com.au
Package 1:xmlrpc-client-3.1.3-8.el7.noarch already installed and latest version
Nothing to do
[root@dhcppc0 devstack]#
Any idea why I can't import six.moves.xmlrpc_client on my python 2.7 installation?
thanks
My problem was that multiple python versions installed on my system. A work around to this problem is to manually install six on your system:
# wget https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55
# tar -zxvf six-1.10.0.tar.gz
# python ./six-1.10.0/setup.py install
# python -c 'import six; print(six.__version__)'
1.10.0