TypeError: 'module' object is not callable using cx_freeze

TypeError: 'module' object is not callable using cx_freeze

我用 cx_Freeze 冻结了我的应用程序,当 运行 运行 .exe 时我收到此错误(仅错误):

C:\Python34\build\exe.win32-3.4>run.exe
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
    exec(code, m.__dict__)
  File "run.py", line 18, in <module>
  File "C:\Python34\Socket.py", line 5, in openSocket
    s = socket.socket()
TypeError: 'module' object is not callable

如果我 运行 我的应用程序在 Python 中,那么它可以完美地工作 fine.I 在主 python 文件(run.py) 和上面错误中提到的 (Socket.py)

我该如何解决这个问题?

尝试将您的 "Socket.py" 文件重命名为其他名称 ("socket_maker.py")。然后从当前目录中删除所有 *.pyc 文件(尤其是任何名为 socket.pyc)的文件。

我认为您尝试导入的模块名称与对象和函数名称冲突。