[英]py2exe and assimulo - No module named algebraic
我正在嘗試在使用庫assimulo(微分方程求解器)的軟件上使用py2exe構建可執行文件。 遇到的問題是在執行過程中我收到:
ImportError:沒有名為代數的模塊
確切的錯誤消息是:
Traceback (most recent call last):
File "main.py", line 89, in <module>
from simulation.simulation import Simulation
File "simulation\simulation.pyc", line 18, in <module>
manages all the action linked to a simulation, like running, saving, replay, etc...
File "solver\assimuloSolver.pyc", line 7, in <module>
Explicit solver to choose in the list of assimulo solvers:
File "assimulo\solvers\__init__.pyc", line 25, in <module>
File "assimulo\solvers\kinsol.pyc", line 12, in <module>
File "assimulo\solvers\kinsol.pyc", line 10, in __load
File "kinsol.pyx", line 1, in init assimulo.solvers.kinsol (assimulo\solvers\kinsol.c:19711)
ImportError: No module named algebraic
在這里,qe可以看到是第7行產生了我的麻煩,而這行是
from assimulo.solvers import Radau5DAE
py2exe的setup.py文件如下所示:
from distutils.core import setup
from py2exe.build_exe import py2exe
import sys
from glob import glob
import matplotlib
data_files = [("Microsoft.VC90.CRT", glob(r'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
data_files.extend(matplotlib.get_py2exe_datafiles())
sys.path.append("C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\redist\\x86\\Microsoft.VC90.CRT")
excludes = ['_gtkagg', '_tkagg']
includes = [
"scipy.sparse.csgraph._validation",
"scipy.special._ufuncs_cxx",
]
opts = {
"py2exe": {
"includes":includes,
"excludes":excludes,
}
}
setup(name = "MySoft",
version = "0.1",
data_files=data_files,
windows=[{"script":"main.py"}], options=opts)
如果有人有線索,我會很感興趣。 謝謝
有時候,我發現py2exe不能包括包裝,即使在封裝選項上市,但已經發現,如果我導入包在setup.py它開始工作,所以嘗試加入,靠近頂部setup.py
:
import assimulo
您有時甚至會發現
if False:
import assimulo
會起作用,(使用assimulo
會在導入上進行很多設置)。
通過在include選項中以這種方式添加代數包,可以解決我的問題:
includes = ["assimulo.algebraic"]
還必須確保將庫添加到PATH變量。 如果沒有,可以簡單地添加sys.path.append(“庫的路徑”),在我的情況下是
sys.path.append("C:\\Python27\\Lib\\site-packages\\assimulo")
在安裝文件中
感謝您的幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.