简体   繁体   中英

Python py2exe Not Including `os` Module

I have a python program which imports os so that I can retrieve the application's path (ie os.path.dirname(os.path.realpath(__file__)) ). I have been using py2exe to make this python file into an exe, and I have had no issues until I started to use os . Here is the command window (notice it says 1 missing Modules ): 在此处输入图片说明

When I try to open the .exe that gets created, it closes on me immediately. All the other imports seem to work fine, and they are: win32api, win32con, time, msvcrt, win32gui, re . Again, the .exe stops working properly when I import os but the Python project itself works fine. What can I do to fix this? Thanks.

使用cx-Freeze在Windows而不是py2exe上创建.exe。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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