从browser / curl请求url时没有名为lxml的模块

I have a python code which runs in my terminal and prints the result. I wrote a php code which executes the python code using exec("python example.py argument_1"). The php code also prints the result while executing it from the terminal.

But when I try to call the php from the browser (or) through a curl request, the result of the php is not being displayed. Apache error log displays the following message.

Traceback (most recent call last):
  File "./example.py", line 3, in <module>
    from lxml import etree
ImportError: No module named lxml 

Kindly look into this issue.

Solution : I had conflict with the python versions

exec("/usr/local/bin/python example.py argument_1") has resolved my issue

I think you can print the sys.path(modules will be fond by python via those path ) for more details. you maybe develop your code in linux.
In linux, each user has different sys.path.
for example, I use root to run python to get sys.path in python,

'/usr/bin',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
 '/usr/lib/python2.7/dist-packages/IPython/extensions']

use an other user to get sys.path in python

['',
 '/home/mahome/anaconda2/bin',
 '/home/mahome/anaconda2/lib/python27.zip',
 '/home/mahome/anaconda2/lib/python2.7',
 '/home/mahome/anaconda2/lib/python2.7/plat-linux2',
 '/home/mahome/anaconda2/lib/python2.7/lib-tk',
 '/home/mahome/anaconda2/lib/python2.7/lib-old',
 '/home/mahome/anaconda2/lib/python2.7/lib-dynload',
 '/home/mahome/anaconda2/lib/python2.7/site-packages',
 '/home/mahome/anaconda2/lib/python2.7/site-packages/Sphinx-1.4.1-py2.7.egg',
 '/home/mahome/anaconda2/lib/python2.7/site-packages/setuptools-23.0.0-py2.7.egg',
 '/home/mahome/anaconda2/lib/python2.7/site-packages/IPython/extensions',
 '/home/mahome/.ipython']

so, you maybe use different user to execuate your code.