I need lxml to use scrapy, but I can't install lxml. .. ..
Common solutions on the net
brew install libxml2 libxslt
It is OK if you install the necessary programs in. For Mac
xcode-select --install
Most of the time it's OK. However, I get a message that the program is no longer provided and the above command cannot be executed. So we need another solution.
In my case, the version of libxml2 that I put in * brew was different from the version of libxml that was specified in / usr / local / bin / xslt-config. * (Maybe this was the direct cause, or it was messed up by messing around) You can find out where you are referring to during pip install by looking at ~ / .pip / pip.log.
The following two measures can be considered.
Modify the version specification of libxml2 installed by brew referenced in / usr / local / bin / xslt-config
Uninstall once with brew remove libxml2, and install libxml2 according to the version in / usr / local / bin / xslt-config.
Regarding 1, the installation of lxml itself was successful, but is it due to the dependency with other programs? I couldn't execute the startproject command with scrapy, and I got the following error.
ImportError: dlopen(/Users/username/.virtualenvs/testenv/lib/python2.7/site-packages/lxml/etree.so, 2): Library not loaded: /usr/local/opt/libxml2/lib/libxml2.2.dylib
Referenced from: /usr/local/opt/libxslt/lib/libxslt.1.dylib
Reason: Incompatible library version: libxslt.1.dylib requires version 12.0.0 or later, but libxml2.2.dylib provides version 11.0.0
The second solution worked! !!
Recommended Posts