I am attempting to export a simple GUI that used NLTK as an exe with Python 3.6 and Windows 10.
When I run PyInstaller to freeze my simple program as an exe I get th
It seems that it is a known bug for the hook of PyInstaller for nltk
. An easy way to fix it is to edit this file:
/Lib/site-packages/PyInstaller/hooks/hook-nltk.py
And comment the lines iterate over nltk_data
:
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2018, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
# hook for nltk
import nltk
from PyInstaller.utils.hooks import collect_data_files
# add datas for nltk
datas = collect_data_files('nltk', False)
# loop through the data directories and add them
# for p in nltk.data.path:
# datas.append((p, "nltk_data"))
datas.append(("", "nltk_data"))
# nltk.chunk.named_entity should be included
hiddenimports = ["nltk.chunk.named_entity"]
Remember to replace path_to_nltk_data
with your currrent path for nltk_data
.