py2exe doesn't import the os module?

2019-06-06 14:38发布

问题:

So, basically, I'm trying to make my Python 2.7 script into an EXE. Here is my setup.py:

from distutils.core import setup
import py2exe
import os

setup(
     options = {
          "py2exe":{
              "includes": ["os"]
              }
          },  
  name = "Anansi CalcPad",
  version = "0.35",
  description = "Anansi CalcPad is a three-tiered application that provides a journal, calculator, and news aggregator in one.",
  author = "Cody Dostal",
  author_email = "cody@seafiresoftware.org",
  url = "http://seafiresoftware.org/wordpress/anansi-calcpad/",
  windows = ["AnansiCalc.py"],
  )

If there is indentation problems, it was caused by a bad copy on StackOverflow's part, not in the code.

Here is the error:

Traceback (most recent call last):
  File "AnansiCalc.py", line 3, in <module>
ImportError: No module named os

What is wrong?