0

I'm trying to import lxml into my code that I'm working with in text editor, using:

from lxml import etree

But when I run my code, I get an import error that says

No module named 'lxml'

If I run python from the terminal, however, I can use the lxml module with no problem. Why is this, and how can I fix it?

Kadir
  • 1,664
  • 2
  • 19
  • 22
  • 1
    How do you run your code from text wrangler? How do you execute your code in the terminal? Do you have virtual environments? – Jeff Mandell Nov 15 '16 at 20:27
  • Probably TextWrangler is running a different `python` binary than you are running in the Terminal. For some potential solutions, see [here](http://apple.stackexchange.com/questions/227224/textwrangler-running-python-2-7-after-i-removed-it-from-my-mac) and [here](https://groups.google.com/forum/#!topic/textwrangler/JgNHoJ3uaUM). – larsks Nov 15 '16 at 21:07

0 Answers0