How do I make py2exe import my etree.pyd in the lxml folder?
When I do
includes = ['lxml.etree']
I get the error: importerror no module named lxml.etree
. If I go into the python console and type
from lxml import etree
import lxml
lxml.etree
Both work just fine. What am I doing wrong?
You really shouldn't need to make this explicit; the module-finder should find the dependency and add it automatically—and if it doesn't, and you don't know of a good reason for that, you should debug it (with py2exe.mf
as described in the docs) first.
But if you do need this, you're going to need the whole lxml
package, not just lxml.etree
. So, just replace:
includes = ['lxml.etree']
… with:
packages = ['lxml']
Or, if you want to include just the top level of the package and the etree
subpackage—I'm not sure whether that will actually work (either at setup time or at runtime), but it might:
includes = ['lxml', 'lxml.etree']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.