私は開発版を使用しています (ここcx_freeze
でアドバイスされているように、最新の安定した 1.3.1 も試しました)。これはファイルです:test.py
import numpy as np
def f(x):
y = np.linspace(0,x,1000)
return y
if __name__ == '__main__':
print f(5)
これは setup.py ファイルです。
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = None
setup( name = "foo",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("test.py", base=base)])
これは、exe を実行したときに表示されるエラーです。
Traceback (most recent call last):
File "C:\Users\Zah\AppData\Local\Enthought\Canopy32\User\lib\site-packages\cx_
freeze-4.3.1-py2.7-win32.egg\cx_Freeze\initscripts\Console.py", line 27, in <mod
ule>
exec code in m.__dict__
File "test.py", line 7, in <module>
File "C:\Users\Zah\AppData\Local\Enthought\Canopy32\User\lib\site-packages\num
py\__init__.py", line 143, in <module>
import add_newdocs
File "C:\Users\Zah\AppData\Local\Enthought\Canopy32\User\lib\site-packages\num
py\add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "C:\Users\Zah\AppData\Local\Enthought\Canopy32\User\lib\site-packages\num
py\lib\__init__.py", line 13, in <module>
from polynomial import *
File "C:\Users\Zah\AppData\Local\Enthought\Canopy32\User\lib\site-packages\num
py\lib\polynomial.py", line 17, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "C:\Users\Zah\AppData\Local\Enthought\Canopy32\User\lib\site-packages\num
py\linalg\__init__.py", line 48, in <module>
from linalg import *
File "C:\Users\Zah\AppData\Local\Enthought\Canopy32\User\lib\site-packages\num
py\linalg\linalg.py", line 23, in <module>
from numpy.linalg import lapack_lite
File "ExtensionLoader_numpy_linalg_lapack_lite.py", line 22, in <module>
File "ExtensionLoader_numpy_linalg_lapack_lite.py", line 14, in __bootstrap__
ImportError: DLL load failed: No se puede encontrar el m¾dulo especificado.
numpy.linalg.lapack_lite.pyd
ビルドディレクトリにファイルがあることに気付きました。