Processing
 

Win7 (x64) - Python error - “ImportError: No module named lxml”

19/09/2016 22:26#1

MO75

Member

Joined at: 5 months ago

Post: 1

Thank: 0

Thanked: 0

I'm fairly new to python, but can't seem to get my head around this error - have found posts with similar issues, but none of the responses have helped.

I'm running Python 3.4.0 and have installed a module called lxml.

I wrote some code which starts

    from lxml import html 

This runs perfectly well from the python.exe interface, and the module can be used to succesfully import and parse XML.

However, if I save the script as a *.py file, and try to call it from a cmd.exe prompt, I get the ImportError: No module named lxml error.

Python is within C:\Python34, and the relevant module is located in C:\Python34\Lib\site-packages\lxml, which contains the required __init__.py file.

I've checked sys.path which, amongst others, holds C:\\Python34\\lib\\site-packages

The double-backslashes and lowercase 'l' in 'lib' shouldn't make a difference, should it? All listed paths appear to have double-backslashes instead of single. I did attempt to add the path with an uppercase 'L' using

    sys.path.insert(1, 'C:\Python34\Lib\site-packages') 

which subsequently appeared as a seperate path, however did not resolve the issue.

Additionally, I replaced the first line of my script with

    import sys     sys.path.append('C:\Python34\Lib\site-packages') 

which appeared to attempt to read the required __init__.py file (progress!!!), but then gave the following error: ImportError: Module use of python34.dll conflicts with this version of Python, so I probably won't pursue this avenue, unless it is of relevance.

Any idea what I'm doing wrong with regards to ImportError: No module named lxml?

Similar articles

How to use Logstash with log4j in Windows 7 32-bit VM

5 months ago - Reply: 1 - Views: 136

Running webrick server in background for Windows

5 months ago - Reply: 0 - Views: 60

Task Scheduler doesn't start my exe for the next day

5 months ago - Reply: 0 - Views: 47

Unable to get Windows Updates in Windows 7 [on hold]

5 months ago - Reply: 0 - Views: 27

Connect Spark-Shell using Eclipse in Windows 7

5 months ago - Reply: 0 - Views: 28

Can't use custom windows themes

5 months ago - Reply: 1 - Views: 117

“npm install <module>” doesn't work

5 months ago - Reply: 0 - Views: 41

OpenGL 4.5 functions segfaulting

5 months ago - Reply: 0 - Views: 6

Executing a batch file during installation

5 months ago - Reply: 0 - Views: 3

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re