简体   繁体   English

创建的exe抱怨ImportError:没有名为pytz的模块

[英]exe created complains about ImportError: no module named pytz

I have created a python executable using py2exe. 我已经使用py2exe创建了一个python可执行文件。 When I run the exe then I get the following error: 当我运行exe时,出现以下错误:

I:\YYY\dist>gui.exe   
Traceback (most recent call last):   
  File "gui.py", line 31, in <module>   
ImportError: No module named pytz  

But, in the python interpreter I can import pytz without any problem. 但是,在python解释器中,我可以毫无问题地导入pytz。

I:\YYY\dist>python  
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32  
Type "help", "copyright", "credits" or "license" for more information.  
>>> import pytz   
>>>

Any help to resolve the above issue is much appreciated. 非常感谢您为解决上述问题提供的任何帮助。

Call setup() with following option: 使用以下选项调用setup():

setup(..., options={
    'py2exe': {
        'packages': [
            'pytz',
        ],
    },
})

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

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