简体   繁体   English

运行exe文件时py2exe错误

[英]py2exe error when running exe file

I have successfully converted .py file to .exe file using py2exe. 我已经使用py2exe成功将.py文件转换为.exe文件。 I can successfully run the .py file,if i run it standalone.However, when iam trying to run the .exe file, it throws an error as seen in attached image. 如果我独立运行.py文件,则可以成功运行。但是,当我尝试运行.exe文件时,它将引发错误,如附件中所示。

In my .py file, i have the below import statements: 在我的.py文件中,我具有以下导入语句:

import xlrd,xlwt,xlutils.copy,re,time,openpyxl,os
from openpyxl.styles import Alignment
from openpyxl import load_workbook

I have also accordingly tweaked setup.py file to include these packages as below setup.py code shows 我还相应地调整了setup.py文件,使其包含这些软件包,如下setup.py代码所示。

from distutils.core import setup
import py2exe

setup(
    console=['vu_t2.py'],
    options = {
        'py2exe': {
            'packages': ['xlrd','xlwt','xlutils','openpyxl','openpyxl.workbook']
        }
    }
)

Please refer the attached error snapshot 请参考所附的错误快照 在此处输入图片说明

I used the below command to run py2exe 我使用以下命令运行py2exe

python setup.py py2exe

openpyxl仅支持通过pip分发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM