小编The*_*iel的帖子

如何阻止在py2exe中编译的Python程序显示ImportError:No Module name'ctypes'

我想知道这可能是编译错误,还是我可以做些什么来阻止它显示.我为cmd制作了一个argparse程序.我使用py2exe编译它,当我运行它时,它正确地执行程序,但在运行代码之前总是会出现此错误:

Traceback (most recent call last):
  File "boot_common.py", line 46, in <module>
ImportError: No module named 'ctypes'
Run Code Online (Sandbox Code Playgroud)

如果它是我的代码中的东西,这是我的脚本:

import argparse
import zipfile
import os
from contextlib import closing

def parse_args():
    parser = argparse.ArgumentParser('ziputil '+\
    '-m <mode> -f <file> -p <output>')
    parser.add_argument('-f', action="store", dest='files', type=str,
                        help='-f <file> : Specify the files to be zipped, or the .zip to be unzipped.')
    parser.add_argument('-m', action="store", dest='mode', type=str,
                        help='-m <mode> : Zip to zip files, UnZip, to unzip files, or     ZipDir to zip entire directories.') …
Run Code Online (Sandbox Code Playgroud)

python compiler-errors py2exe argparse

2
推荐指数
1
解决办法
6281
查看次数

标签 统计

argparse ×1

compiler-errors ×1

py2exe ×1

python ×1