import lxml fails on OSX after (seemingly) successful install

戏子无情 提交于 2019-11-29 11:28:55

You've installed a newer version of Python (2.7.2) but you also need to install and use a copy of easy_install (from Distribute or setuptools) to use with it. You ended up using the default Apple-supplied version of easy_install associated with the Apple-supplied Python 2.6. Note the /Library/Python/2.6 in the easy_install output. (You can verify that by trying to import lxml when using /usr/bin/python2.6.) After you install easy_install using your Python 2.7, the new easy_install should be first on your shell path if you used the standard python.org installer defaults. If not, update your PATH:

export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"

Then easy_install lxmlusing it. With the python.org 2.7.2, you shouldn't need to add the ARCHFLAGS environment variable but it doesn't hurt.

You should just be able to run:

sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install-2.7 lxml

This will use the easy_install version that came with your 2.7 installation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!