Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named lxml on Mac

Tags:

python

macos

lxml

I am having a problem running a Python script and it is showing this message:

ImportError: No module named lxml

I suppose I have to install somewhat called lxml but I am really newbie to Python and I don't really have too much idea on that.

I think I have two versions of Python installed on my Mac from what I have read in other threads, but I am not sure.

How can I solve this issue?

Python Version: 2.7.6

Mac OS X 10.9.2

like image 768
Alex Avatar asked Mar 26 '14 22:03

Alex


2 Answers

I've installed recently using pip, but before it would all work, I needed to issue the following command as instructed in this post:

xcode-select --install

If you don't have pip, you can get it from easy_install. If I recall correctly, the full sequence of commands should be something like this (assuming you already have gotten Xcode):

sudo easy_install pip
xcode-select --install
sudo pip install lxml
like image 132
mgilson Avatar answered Nov 12 '22 06:11

mgilson


The answer of your question is here: http://lxml.de/installation.html#installation

Go to the MacOS section and follow the instructions :-)

like image 4
Brice Argenson Avatar answered Nov 12 '22 06:11

Brice Argenson