打包过程中正常没有问题,当用python脚本调用或执行exe时出现报错
大概错误如下
No module named tslib tslib not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first
在尝试spec文件中增加如下打包后没有解决问题
def get_pandas_path():
import pandas
pandas_path = pandas.__path__[0]
return pandas_path
并且包中含有tslib文件但运行仍显示没有
最终解决办法
Pyinstaller -F RemoveRepeat.py --hidden-import=pandas --hidden-import=tslib --additional-hooks-dir=.
利用上述打包解决问题可以正常调用