Py2exe lxml woes

喜你入骨 提交于 2019-11-28 05:22:14

Py2exe allows you to specify additional packages/modules to include with the options argument to setup(), in case they are not automatically detected. The following should work:

from distutils.core import setup
import py2exe

setup(
    windows=[{'script': 'gui.py'}],
    options={
        'py2exe': 
        {
            'includes': ['lxml.etree', 'lxml._elementpath', 'gzip'],
        }
    }
)

I've also recently discovered PyInstaller, which has built-in support for a number of well-known packages, including lxml, so that might be worth a try as well.

Progsam

Sometimes you will need to do another action more after modify the setup.py file.

As described here, it should be necessary to uninstall the package if it is installed on "eggs" archive. Then install it again by forcing easy_install to dezip the archive with the "-Z" option as following (I had the issue with paramiko package):

pip uninstall paramiko
easy_install -Z paramiko
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!