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

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 
  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 
  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)