Unable to import lxml from terminal on MAC. Getting this below error
ERROR:
python
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so, 2): Symbol not found: _PyUnicodeUCS4_AsASCIIString
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lxml/etree.so
Expected in: dynamic lookup
>>>
'import lxml' works fine
Python path
which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
when i look for lxml installation, everything looks fine
pip install lxml
Requirement already satisfied: lxml in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
pip2 install lxml
Requirement already satisfied: lxml in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
What am i missing here ? what could be wrong ? can you please help me.
SOLUTION:
solved it by uninstalling lxml
and re-installed by pip install lxml --no-binary :all: