关键点是找到缺失的依赖文件pyd,以及命名方式。加油!
问题描述:
Traceback (most recent call last):
File "<string>",line 22,in <module>
File "d:\anaconda\lib\site-packages\PyInstaller-3.0-py2.7.egg\PyInstaller\load
er\pyimod03_importers.py",line 363,in load_module
exec(bytecode,module.__dict__)
File "E:\Documents\WFLayout_Neimeng\WFLayout\src\windFarmLayout.py",line 17,
in <module>
import calculate_power
File "d:\anaconda\lib\site-packages\PyInstaller-3.0-py2.7.egg\PyInstaller\load
er\pyimod03_importers.py",module.__dict__)
File "E:\Documents\WFLayout_Neimeng\WFLayout\src\calculate_power.py",line 10,
in <module>
import wake_model
File "d:\anaconda\lib\site-packages\PyInstaller-3.0-py2.7.egg\PyInstaller\load
er\pyimod03_importers.py",module.__dict__)
File "E:\Documents\WFLayout_Neimeng\WFLayout\src\wake_model.py",line 12,in <
module>
from scipy import interpolate
File "d:\anaconda\lib\site-packages\PyInstaller-3.0-py2.7.egg\PyInstaller\load
er\pyimod03_importers.py",module.__dict__)
File "d:\Anaconda\lib\site-packages\scipy\interpolate\__init__.py",line 145,
in <module>
from .interpolate import *
File "d:\anaconda\lib\site-packages\PyInstaller-3.0-py2.7.egg\PyInstaller\load
er\pyimod03_importers.py",module.__dict__)
File "d:\Anaconda\lib\site-packages\scipy\interpolate\interpolate.py",line 15
,in <module>
import scipy.linalg
File "d:\anaconda\lib\site-packages\PyInstaller-3.0-py2.7.egg\PyInstaller\load
er\pyimod03_importers.py",module.__dict__)
File "d:\Anaconda\lib\site-packages\scipy\linalg\__init__.py",line 188,in <m
odule>
from ._decomp_update import *
File "d:\anaconda\lib\site-packages\PyInstaller-3.0-py2.7.egg\PyInstaller\load
er\pyimod03_importers.py",line 517,in load_module
module = imp.load_module(fullname,fp,filename,ext_tuple)
File "scipy\linalg\_decomp_update.pyx",line 1,in init scipy.linalg._decomp_u
pdate (scipy\linalg\_decomp_update.c:35835)
ImportError: No module named cython_blas
start_ga_wfLayout returned –1
start_ga_wfLayout是打包生成的exe文件名称。上面显示在执行start_ga_wfLayout时找不到模块cython_blas.
使用的软件版本是:pyinstaller 3.0 + anaconda 2.3.0
问题分析:
根据提示找到目录:D:\Anaconda\Lib\site-packages\scipy\linalg
发现里面既有_decomp_update.pyd,也有cython_blas.pyd,同时在打包生成的dist\start_ga_wfLayout目录下存在scipy.linalg._decomp_update.pyd,这说明问题出现在pyinstaller打包过程中:没有将cython_blas.pyd打包。
如果直接将cython_blas.pyd拷贝到打包目录下,问题仍然存在。
解决方法:
根据scipy.linalg._decomp_update.pyd的命名规则,应该将cython_blas.pyd修改成scipy.linalg.cython_blas.pyd
命名规则可以参考python packages,如sound/effects/echo.py引用方法:import sound.effects.echo
原文链接:https://www.f2er.com/javaschema/283529.html