Pyexpat import error when running aws cli
I'm having trouble getting aws cli to run on ubuntu 14.04 I keep getting the following error:
Traceback (most recent call last): File "/usr/local/bin/aws", line 15, in <module> import awscli.clidriver File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 16, in <module> File "/usr/local/lib/python2.7/dist-packages/botocore/session.py", line 27, in <module> import botocore.credentials File "/usr/local/lib/python2.7/dist-packages/botocore/credentials.py", line 23, in <module> from botocore.compat import total_seconds File "/usr/local/lib/python2.7/dist-packages/botocore/compat.py", line 118, in <module> import xml.etree.cElementTree File "/usr/lib/python2.7/xml/etree/cElementTree.py", line 3, in <module> from _elementtree import * ImportError: PyCapsule_Import could not import module "pyexpat"
When i do
ls -l /usr/lib/python2.7/*/pyexpat*
-rw-r--r-- 1 root root 69200 Mar 23 01:57 /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
Any help is greatly appreciated.
Somehow the problem was that I had to run aws commands with sudo.
source to share
I had to face a similar problem when I was parsing xml in Python (2.7). Finally, it turned out that it was caused by an inaccurately defined environment variable
. Here is my situation: xml syntax parsing library: libexpat.so was confused with the MATLAB version (libexpat.so.1.5.0) between the system version (libexpat.so.1.6.0),
occurred when loading MATLAB version libexpat.so, after I figured out exactly
which excludes the MATLAB library path, everything went smoothly.
source to share