如何在Python制作的可执行应用程序中包含NLTK包? [英] How to include NLTK package in executable application made in Python?

查看:66
本文介绍了如何在Python制作的可执行应用程序中包含NLTK包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pyinstaller --onefileD:/mypython/my_nltk_code.py



我创建了一个python可执行文件并单独运行没有安装python的客户端机器。它给了我以下错误:



pyinstaller --onefile "D:/mypython/my_nltk_code.py"

I created a python executable and ran it on separate client machine that does not have python installed. It gave me the following error:

Resource 'tokenizers/punkt/english.pickle' not found.  Please
use the NLTK Downloader to obtain the resource:  >>>
nltk.download()





我希望我的python可执行应用程序独立运行而不需要任何即使没有在客户端计算机上安装python也会出错。



谢谢!寻求专家帮助。



我尝试过:



创建设置.py文件



#!/ usr / bin / env python
来自distutils.core导入设置的






setup(name ='nltk',

version ='3.2.2',

description = '自然语言工具包(NLTK)是一个用于自然语言处理的Python包.NLTK需要Python 2.7或3.4+。',

author ='Steven Bird',

author_email ='',

url ='https://pypi.python.org/pypi/nltk#downloads/',

packages = ['nltk 3.2。 2'],





&


来自setuptools import的
setup,find_packages

来自setuptools.command.install import install as _install





class Install(_install) :

def run(self):

_install.do_egg_install(self)

import nltk

nltk.download(all)



setup(

cmdclass = {'install' :安装},

install_requires = ['nltk',],

setup_requires = ['nltk']



I want my python executable application to run independently without any error even without python being installed on the client machine.

Thanks! seeking expert help.

What I have tried:

creating setup.py file

#!/usr/bin/env python

from distutils.core import setup

setup(name='nltk',
version='3.2.2',
description='The Natural Language Toolkit (NLTK) is a Python package for natural language processing. NLTK requires Python 2.7, or 3.4+.',
author='Steven Bird',
author_email='',
url='https://pypi.python.org/pypi/nltk#downloads/',
packages=['nltk 3.2.2'],
)

&

from setuptools import setup, find_packages
from setuptools.command.install import install as _install


class Install(_install):
def run(self):
_install.do_egg_install(self)
import nltk
nltk.download("all")

setup(
cmdclass={'install': Install},
install_requires=['nltk',],
setup_requires=['nltk']
)

推荐答案

我有类似的问题。你找到了解决方案吗?
I have a similar issue. Did you find a solution?


这篇关于如何在Python制作的可执行应用程序中包含NLTK包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆