Python pyinstaller打包pyechart的最佳方法
- 打包pyechart错误信息
FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Users\xxx\AppData\Local\Temp\_MEI944442\pyecharts\datasets\map_filename.json’
2.原因: pyinstaller与yechart不兼容
3.方法:在PyInstaller安装目录下
- \AppData\Roaming\Python\Python37\site-packages\PyInstaller\hooks\ 需要增加如下文件,
hook-pyecharts.py 文件内容:
#-----------------------------------------------------------------------------
# Copyright (c) 2017-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
#-----------------------------------------------------------------------------
# Hook for nanite: https://pypi.python.org/pypi/nanite
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('pyecharts')
然后删除工程下面xxxxx.spec 文件,重新打包,即可。
我的个人博客fangzengye.com, 欢迎来撩哦!
原文博主: 热衷开源的宝藏Boy
版权声明: 自由转载-非商用-禁止演绎-保持署名| CC BY-NC-ND 3.0
浙公网安备 33010602011771号