cx_Freeze- ImportError: cannot import name setup

老子叫甜甜 提交于 2019-12-20 06:33:36

问题


I'm using a Windows 7 machine with cx_Freeze 4.3.1 with Python 3.3, both Python and cx_Freeze are 32-bit versions. I've written a setup.py script that looks like this:

import sys

from cx_Freeze import setup, Executable

setup( 

    name = "Macro Generator",
    version = "1.1",
        description = "Writes Macros for you",
        executables = [Executable("program.py")]
      )

When I navigate to the setup.py file location and try to create this executable from the command prompt using:

python setup.py build

I receive the following error.

Traceback (most recent call last):
 File "setup.py", line 2, in <module>
    from cx_Freeze import setup, Executable
ImportError: cannot import name setup

I've also tried to build executables out of some of the sample programs provided with the cx_Freeze download, but I receive the same error for those as well. I've uninstalled cx_Freeze and tried a different version, but the error persists.

Does anyone have any ideas?

Thanks, let me know if you need additional information.


回答1:


Resolved, I removed import sys from my setup.py file and the program compiled successfully.



来源:https://stackoverflow.com/questions/23771188/cx-freeze-importerror-cannot-import-name-setup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!