錯誤信息
- 刪除打包產生的文件:dist文件夾,build文件夾,還有spec文件
先安裝pip install pywin32
python用pyinstaller打包后,運行程序報錯"pkg_resources.DistributionNotFound"的解決辦法…
pkg_resources.DistributionNotFound:the "prettytable" distribution was not found....
這里明明已經打包好了exe文件,也沒有報錯。但是運行exe時候,卻彈出這個界面一閃而過。
之后再查閱了pyinstaller的官方文檔后,找到了解決辦法。
在目標文件目錄下創建一個hook-ctypes.macholib.py文件:
里面的內容如下:
# -*- coding: utf-8 -*-
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('prettytable')
這樣修改以后,打包出來的exe文件就能夠正常使用了。
希望碰到同樣的問題的小伙伴,可以從這里找到一些幫助。