编译到exe时,你会遇到这个问题.
我可以想到允许用户使用其他插件访问任何python库的唯一选择是在exe包中包含所有库.
将支持的库限制为子集可能是个好主意,并将其列在文档中.由你决定.
我只用过py2exe.
在py2exe中,您可以指定在setup.py文件中的搜索中找不到的库.
这是一个示例:
from distutils.core import setup
import py2exe
setup (name = "script2compile",console=['script2compile.pyw'],version = "1.4",author = "me",author_email="somemail@me.com",url="myurl.com",windows = [{
"script":"script2compile.pyw","icon_resources":[(1,"./ICONS/app.ico")] # Icon file to use for display
}],# put packages/libraries to include in the "packages" list
options = {"py2exe":{"packages": [ "pickle","csv","Tkconstants","Tkinter","tkFileDialog","pyexpat","xml.dom.minidom","win32pdh","win32pdhutil","win32api","win32con","subprocess",]}}
)
import win32pdh
import win32pdhutil
import win32api