>데이터 베이스 >MySQL 튜토리얼 >py2exe ImportError: No module named iterators,ImportError:

py2exe ImportError: No module named iterators,ImportError:

WBOY
WBOY원래의
2016-06-07 15:26:491140검색

1、ImportError: No module named iterators,ImportError 把使用email库缺失的模块都加进去: 方法一: 在setup.py添加如下代码, from distutils.core import setup import py2exe, sys, os #sys.argv.append( 'py2exe' ) includes = [ 'email.charset' , '

1、ImportError: No module named iterators,ImportError

把使用email库缺失的模块都加进去:

方法一:

在setup.py添加如下代码,

from distutils.core import setup

import py2exe, sys, os

#sys.argv.append('py2exe')

includes = ['email.charset', 'email.encoders', 'email.generator', 'email.header', 'email.iterators', 'email.mime.audio', 'email.mime.base', 'email.mime.image','email.mime.multipart','email.mime.text','email.message', 'email.utils', 'email.base64mime']

setup(

    options = {'py2exe':

                {'bundle_files': 1,

                 'includes':includes

                  }},

    console = [test.py'],

    zipfile = None,

)

方法二:

只需要在你要编译的相应的程序文件中我的文件test.py加放如下import
要注意大小写哈___


import smtplib,email,sys
from email.mime.text import MIMEText
from email.Message import Message
import email.Utils
import email.generator
import email.base64MIME
import email.iterators
import email.message

相应用到py2exe setup.py文件中,相关代码如下:


from distutils.core import setup
import py2exe


setup(
        console=[server.py'],
        options={
                "py2exe":{

                       'bundle_files': 1,
                        "unbuffered": True,
                        "optimize": 2,
                        "includes": ["email"]
                }
        }
)


2、ImportError: MemoryLoadLibrary failed loading win32ap

setup.py中添加如下代码: setup的 option 选项中加入 "dll_excludes": [ "mswsock.dll","powrprof.dll" ]即可,

原因:py2exe mistakenly added powrprof.dlland mswsock.dll to the package. Windows XP contains its own copiesof these files though

setup(

    options = {'py2exe':

                {'bundle_files': 1,

                 "dll_excludes": [ "mswsock.dll","powrprof.dll" ]

                 }},

    console = [test.py'],

    zipfile = None,

)

参考文献:

http://www.alarmchang.com/wiki/index.php?title=Python&diff=prev&oldid=618

http://stackoverflow.com/questions/1979486/py2exe-win32api-pyc-importerror-dll-load-failed

http://hi.baidu.com/jetqu2003/blog/item/39770003abb766713812bb4e.html



성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
이전 기사:【Cocos2dX(2.x)다음 기사:Ubuntu 12.04安装Redmine 2.4.2