免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5951 | 回复: 10
打印 上一主题 下一主题

py2exe-明明有user32.dll,为什么还要报错? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-09-08 15:00 |只看该作者 |倒序浏览
*** copy extensions ***
copying C:\Python24\DLLs\bz2.pyd ->; C:\Python24\mywork\clock\dist
copying C:\Python24\DLLs\unicodedata.pyd ->; C:\Python24\mywork\clock\dist
copying C:\Python24\DLLs\zlib.pyd ->; C:\Python24\mywork\clock\dist
*** copy dlls ***
copying C:\Python24\w9xpopen.exe ->; C:\Python24\mywork\clock\dist
copying C:\WINDOWS\system32\python24.dll ->; C:\Python24\mywork\clock\dist
setting sys.winver for 'C:\Python24\mywork\clock\dist\python24.dll' to 'clock'
copying C:\WINDOWS\system32\MSVCR71.dll ->; C:\Python24\mywork\clock\dist

*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.

Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.

        ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll
        USER32.dll - C:\WINDOWS\system32\USER32.dll
        SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll
        KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll

好像说的是这几个dll文件找不到。但我找过,有,而且路径也是对的。

python 2.4.1
py2exe 0.6
windows XP
C盘是NTFS的文件系统。小弟初学python,请教。

论坛徽章:
0
2 [报告]
发表于 2005-09-08 15:03 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

exe文件生成了没有?

论坛徽章:
0
3 [报告]
发表于 2005-09-08 17:22 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

没有.
写了一个hello world,可以生成.但加上Tkinter之后就不行了.
好像只要加载模块就编译不成功。

dist目录里除了exe以外,别的都有。w9x*.exe也生成了。有python24.dll,libary.zip也生成了。*.pyc也有。

论坛徽章:
0
4 [报告]
发表于 2005-09-08 20:35 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

估计是缺乏Tkinter的py2exe环境.
用--help命令看一下好吗/
我这里的机器上没有装py2exe,没办法帮你.

论坛徽章:
0
5 [报告]
发表于 2005-09-08 20:50 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

你的setup.py怎么写的,贴出来看看

论坛徽章:
0
6 [报告]
发表于 2005-09-08 22:28 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

#hls.py
from Tkinter import *
import colorsys

def update(*args):
        r,g,b = colorsys.hls_to_rgb(h.get()/255.0,l.get()/255.0,s.get()/255.0)
        r,g,b = r*255,g*255,b*255
        rgb.configure(text='RGB%d,%d,%d)' % (r,g,b))
        c.configure(bg='#%02X%02X%02X' % (r,g,b))
       
root = Tk()
hue = Label(root,text='Hue')
hue.grid(row=0,column=0)
light = Label(root,text="Light"
light.grid(row=0,column=1)
sat = Label(root,text='Saturation')
sat.grid(row=0,column=2)
rgb = Label(root,text='RGB0,0,0)')
rgb.grid(row=0,column=3)

h = Scale(root,from_=255,to_=0,command=update)
h.grid(row=1,column=0)
l = Scale(root,from_=255,to_=0,command=update)
l.grid(row=1,column=1)
s = Scale(root,from_=255,to_=0,command=update)
s.grid(row=1,column=2)

c = Canvas(root,width=100,height=100,bg='Black')
c.grid(row=1,column=3)

root.mainloop()

[书上抄的一道例题。]

# setup.py
from distutils.core import setup
import py2exe

setup(name="choosecolor",scripts=["hls.py"],)

hls.py用pythonw.exe可以直接正常打开,但就是编译不了。
我机子上是装了Tkinter的。(好像2.4的都是装python的时候就自己动装上Tkinter了吧。)

P.S:这些例子都是从《Python v2.1宝典》上抄的。刚看了一点,书就不见了。郁闷ing,还要赔给图书馆啊!五倍的money啊!

论坛徽章:
0
7 [报告]
发表于 2005-09-09 09:14 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

第一,请以后贴代码的时候注意使用code标签来缩进

我的环境为Python 2.3+py2exe 0.5
hls.py代码如下

  1. from Tkinter import *
  2. import colorsys

  3. def update(*args):
  4.     r,g,b = colorsys.hls_to_rgb(h.get()/255.0,l.get()/255.0,s.get()/255.0)
  5.     r,g,b = r*255,g*255,b*255
  6.     rgb.configure(text='RGB:(%d,%d,%d)' % (r,g,b))
  7.     c.configure(bg='#%02X%02X%02X' % (r,g,b))

  8. root = Tk()
  9. hue = Label(root,text='Hue')
  10. hue.grid(row=0,column=0)
  11. light = Label(root,text="Light")
  12. light.grid(row=0,column=1)
  13. sat = Label(root,text='Saturation')
  14. sat.grid(row=0,column=2)
  15. rgb = Label(root,text='RGB:(0,0,0)')
  16. rgb.grid(row=0,column=3)

  17. h = Scale(root,from_=255,to_=0,command=update)
  18. h.grid(row=1,column=0)
  19. l = Scale(root,from_=255,to_=0,command=update)
  20. l.grid(row=1,column=1)
  21. s = Scale(root,from_=255,to_=0,command=update)
  22. s.grid(row=1,column=2)

  23. c = Canvas(root,width=100,height=100,bg='Black')
  24. c.grid(row=1,column=3)

  25. root.mainloop()
复制代码

setup.py的代码如下,我改动了这个文件内容

  1. from distutils.core import setup
  2. import py2exe

  3. setup(windows=["hls.py"],)
复制代码

编译过程如下

  1. python setup.py py2exe
  2. .............
  3. ...............
  4. ...........
  5. *** copy dlls ***
  6. copying C:\WINDOWS\system32\python23.dll ->; D:\tt\dist
  7. copying c:\python23\DLLs\tcl84.dll ->; D:\tt\dist
  8. copying C:\WINDOWS\system32\COMCTL32.dll ->; D:\tt\dist
  9. copying c:\python23\w9xpopen.exe ->; D:\tt\dist
  10. copying c:\python23\DLLs\tk84.dll ->; D:\tt\dist
  11. copying c:\python23\lib\site-packages\py2exe\run_w.exe ->; D:\tt\dist\hls.exe
复制代码

成功生成hls.exe

论坛徽章:
0
8 [报告]
发表于 2005-09-09 09:24 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

[quote]原帖由 "xichen"]成功生成hls.exe[/quote 发表:
同意,方便别人试验你的代码

你的问题这样解决,把setup.py改成这样
  1. # setup.py
  2. from distutils.core import setup
  3. import py2exe
  4.      
  5. setup(name="choosecolor",windows=["hls.py"],)
复制代码


注意这里  windows=["hls.py"]

论坛徽章:
0
9 [报告]
发表于 2005-09-09 09:25 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

[quote]原帖由 "xichen"]成功生成hls.exe[/quote 发表:


还是老大你快啊,呵呵

论坛徽章:
0
10 [报告]
发表于 2005-09-09 09:31 |只看该作者

py2exe-明明有user32.dll,为什么还要报错?

呵呵。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP