我正在尝试使用pyinstaller将dask数据帧转换为打包的可执行文件。
我刚拿到
import dask
在我的可执行文件中,我将其打包为
pyinstaller scripts.py
当我运行它时,我发现找不到/some/path/dask.yaml。
有没有人知道我是否应该添加隐藏的导入,或者如何解决这个问题?
发布于 2019-07-16 22:58:18
要将dask与PyInstaller一起使用,您需要使用add-data标志将dask.yaml和distributed.yaml添加到输出可执行文件中:
pyinstaller -F --add-data "<python_path>/Lib/site-packages/dask/dask.yaml;./dask" --add-data "<python_path>/Lib/site-packages/distributed/distributed.yaml;./distributed" script.py发布于 2020-07-20 12:27:46
如果dask安装在<python_path>\Lib\site-packages\theano中,则需要创建一个包含以下内容的钩子-dask.py文件:
from PyInstaller.utils.hooks import get_package_paths
datas = [(get_package_paths('dask')[1],"dask"),]并将此文件复制到您的PyInstaller文件夹:
Lib\site-packages\PyInstaller\hooks
运行pyinstaller时,需要使用-p选项添加site-packages的路径:
pyinstaller myApp.py -p <python_path>\Lib\site-packages它会将整个dask文件夹复制到dist输出文件夹中。
https://stackoverflow.com/questions/57057336
复制相似问题