*有想法该怎么解决这个吗?我需要在setup.py中包含哪些内容?
当我去运行exe时,它说:
c:\python32\Scripts\dist>Assignment4_5.exe Traceback (most recent call last): file "C:\python32\lib\site-packages\cx_Freeze\initscripts\Console3.py",line 2 7,in <module> exec(code,m.__dict__) file "c:\python32\Assignment4_5.py",line 6,in <module> import numpy as np file "C:\python32\lib\site-packages\numpy\__init__.py",line 137,in <module> from . import add_newdocs file "C:\python32\lib\site-packages\numpy\add_newdocs.py",line 9,in <module> from numpy.lib import add_newdoc file "C:\python32\lib\site-packages\numpy\lib\__init__.py",line 17,in <modul e> from .npyio import * file "C:\python32\lib\site-packages\numpy\lib\npyio.py",in <module> from . import format importError: cannot import name format c:\python32\Scripts\dist>
Setup.py:
from cx_Freeze import setup,Executable includeDependencIEs = [] setup( name = "Assignment4_5PythonExe",version = "0.1",description = "Sort Methods",executables = [Executable("Assignment4_5.py")] )解决方法 这是cx_Freeze中的一个错误 – 它不会自动检测到它应该复制模块numpy.lib.format.它已经在 development version中修复了,所以如果你能够尝试它,它应该可以工作.
否则,您需要指定numpy.lib.format需要包含在setup.py中.该行看起来像这样:
options = {"build_exe": {"packages": ["numpy.lib.format"]}},
另见the documentation.
总结以上是内存溢出为你收集整理的使用Numpy for Python创建cx_Freeze exe全部内容,希望文章能够帮你解决使用Numpy for Python创建cx_Freeze exe所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)