第三方库和Py2exe [英] 3rd Party Libraries and Py2exe

查看:1078
本文介绍了第三方库和Py2exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎么会去捆绑,比如说,美丽的汤成一个exe与我的code。使用py2exe沿?

在code现在我用我的setup.py是

 从distutils.core进口设置
进口py2exe#与等效的​​选项命令行是:
#蟒蛇setup.py py2exe --com pressed --bundle-文件= 2 --dist-DIR =我/距离/ DIR--dll-排除=w9xpopen.exe
选项​​= {'py2exe:{
           COM pressed':1,
           'bundle_files':1,
           dist_dir:EXE /距离/目录
           dll_excludes'}}设置(控制台= [''],选择=选项,zip文件=无)


解决方案

在你的选项您可以添加属性包括并添加库的方式。举个例子:

 选项= {py2exe:{
                包括:LIBRARY HERE,...]
          }}

这包括那些尚未被发现由Py2exe外部库。如果我没有记错,Py2exe应该设法找到它自己的依赖和任何它没有找到,您可以使用上面的方法。

我不知道库结构美丽的汤,因为我已经没有使用它,而是一个例子是:

包含:matplotlib.backends.backend_tkagg]

How would I go about bundling, say, Beautiful soup into an exe along with my code using py2exe?

The code I am using for my setup.py right now is

from distutils.core import setup
import py2exe

# equivalent command line with options is:
# python setup.py py2exe --compressed --bundle-files=2 --dist-dir="my/dist/dir" --dll-excludes="w9xpopen.exe"
options = {'py2exe': {
           'compressed':1,  
           'bundle_files': 1, 
           'dist_dir': "exe/dist/dir"
           'dll_excludes'  }}

setup(console=[''], options=options,zipfile = None)

解决方案

In your options you can add an attribute includes and add the libraries that way. An example:

options = { "py2exe": {
                "includes": ["LIBRARY HERE", ...]
          }}

This includes external libraries that haven't already been found by Py2exe. If I remember correctly, Py2exe should try to find the dependencies on it's own and any it doesn't find you can use the above method.

I'm not sure about the library structure for Beautiful Soup as I've not used it, but an example would be:

"includes": ["matplotlib.backends.backend_tkagg"]

这篇关于第三方库和Py2exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆