How to add egg files and import modules in python?

955 Views Asked by At

How do we import modules from egg file in python? I have to import modules from lxml.egg and need to add it as a package to the transform script (in python) for running a map reduce job. I tried adding the egg file to sys.path and then importing it, but it did not work.

1

There are 1 best solutions below

0
On

You can put the path to the egg file at the beginning of sys.path so that you can make sure the module you want to import is not masked by others in sys.path.