欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

pyinstaller 打包程序带上导入包下面的文件

程序员文章站 2022-06-06 07:53:06
...
Building prefix dict from the default dictionary ...
Exception in Tkinter callback
Traceback (most recent call last):
  File "tkinter\__init__.py", line 1705, in __call__
  File "DWTool.py", line 131, in <lambda>
  File "DWTool.py", line 43, in translatebutton
  File "translation.py", line 45, in read_to_translate
  File "jieba\__init__.py", line 395, in load_userdict
  File "jieba\__init__.py", line 170, in check_initialized
  File "jieba\__init__.py", line 145, in initialize
  File "jieba\__init__.py", line 376, in get_dict_file
  File "jieba\_compat.py", line 21, in <lambda>
  File "pkg_resources\__init__.py", line 1151, in resource_stream
  File "pkg_resources\__init__.py", line 1398, in get_resource_stream
  File "pkg_resources\__init__.py", line 1401, in get_resource_string
  File "pkg_resources\__init__.py", line 1540, in _get
  File "PyInstaller\loader\pyimod03_importers.py", line 365, in get_data
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Desktop\\DWTool2\\jieba\\dict.txt'

加上 -r 参数

example:

pyinstaller -F main.py - -r D:\pythonenvirenment\Lib\site-packages\jieba\dict.txt

相关标签: python python